-1

I've been using shared hosting up until recently before switching to a normal VPS for learning. Currently my server only run wordpress and forum on top nginx + mysql and nothing else. I've read somewhere that using Varnish will speed up my site loading time. For now, I don't need it but for learning sake I would like to ask a couple questions that I unable to google.

  1. How does Varnish knows when will the file expired? Do I need to setup rules in the VCL or I can set the expiry header in Nginx/Apache and Varnish will handle it automatically?

  2. Can I set different expiry time for different page? Example: 2 days for www.mydomain.com/page1.php and 5 days for www.mydomain.com/page2.php

  3. Can I save forum search string for certain time (1 day)? Example: forum.mydomain.com/index.php?act=Search&search_in=posts&result_type=topics&highlite=mystring

Thank you in advance.

1 Answers1

1

1) Varnish honors the cache headers (Cache-control, expires, etc.) from the source, so whatever PHP/nginx are setting is what varnish will use. This can be overridden in varnish though.

2) Again, this is dictated based on what headers page1.php and page2.php are setting.

3) Not sure about this one.

chrskly
  • 1,569
  • 12
  • 16