Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please assume that there is a PHP CMS that retrieves content according to IDs from database.

So every time you visit this website it interacts with Database and Processes the PHP request.

Can Nginx or Varnish cache and store a page after user visited that page? So next time if any user visits that page it will load from the cache.

share|improve this question
For a per-user or a per-site cache? Both are possible. – pkhamre Oct 22 '12 at 9:49
+1 Thanks, actually I don't understand differences between per-user and per-site cache. I mean if first user loaded a page, next user would load that page faster. does this save files as html or something? – Zim3r Oct 22 '12 at 9:59
You need to understand the difference. A per-user cache simply means that pages is cached, so when user A hits page A it loads from the backend, but the next time user A hits page A its from the cache. A per-site cache means that when user A hits page A it loads from the backend, and the next time user B hits page A it loads from the cache. – pkhamre Oct 22 '12 at 10:04
Basically, does your users get different content or does everyone see the same content? – pkhamre Oct 22 '12 at 10:05
Then running Varnish with the default configuration will get you started out with caching. – pkhamre Oct 22 '12 at 10:28
up vote 2 down vote accepted

Varnish is capable of caching content infront of your CMS. You will get a conservative caching policy with the default configuration so I suggest you start with this and work your way up from there.

You should also know that Varnish is not a disk cache, but an in-memory cache.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.