How to create server Cache for static page

I developed a website. Now i want to create server cache for this site to avoiding overload and easy to load. Hi, i am not sure about this topic so anyone explain in detail how to create cache and then how to make changes in cache. share your ideas and suggestions.

The easiest way would be to use an in-built or plugin cache facility if you are using a CMS that has this. Secondly, you can use a web server module such as apache mod_cache if your hosting allows installation or modification of the web server. There are also applications like varnish or squid that can act as a cache in front of apache, however setting this up requires a bit more knowledge of server administration.

It’s quite easy to write caching code. On each page load, check whether a cache exists and is within an allowed ‘age’, if so open and serve this file, if not go through your normal page generation and write it to disk and serve.

Mike,

While I concur IF the question had been for dynamic pages, the question was for a static page. How much benefit can be gained by caching a static page? Just off the top of my head, I can’t imagine any benefit unless the caching includes compression … which can be done without caching, i.e., as part of creating the static page.

Regards,

DK

I have seen performance gains from memory caching static pages but that was under extreme circumstances – namely a massive DDOS attack. Under normal circumstances the only thing that would help you here is if you had horribly slow disk performance and that is an easy problem to fix.

If you really want to pursue this I would consider using nginx or varnish as that is what they are designed to do and they do it very, very well.