Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

closed as not a real question by Michael Hampton, mdpc, Khaled, Scott Pack, longneck Feb 4 '13 at 19:19

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 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.

share|improve this answer