Nginx proxy

  
 

nginx's proxy_cache is the most cost-effective cache. My current configuration is LiteSpeed+nginx. I can refer to apache+nginx

to give dynamic content to LiteSpeed ​​or apache for processing, and then use proxy_cache to reverse proxy. All cached on the hard disk, become static content, everyone knows how powerful nginx running static content, so you can run large PV in small memory.

But this will bring a problem, temporarily Think of one, that is, the website is very interactive, that is, there are a lot of guest messages, then you can't refresh the comments. The solution I chose is: the member who has logged in or the guest with the message cookie, does not cache or cache for 5 to 15 minutes. Refresh the page.

This is the cheapest and most practical website acceleration method, definitely not worse than Varnish...Varnish is a memory level cache, nginx is a hard disk. All static files, you can feel Is the memory read faster than the hard disk? Of course, if you are a stand-alone server and a large memory user, using Varnish is a good choice. This is the performance of money piled up...

ps, Nginx has another caching method, which is to use fastcgi _cache directly cache dynamic content, very simple configuration, lnmp can be, the method is basically the same as proxy_cache. But I feel no proxy_cache, I use fastcgi_cache (configuration is lnmp), the website load is 0.3-0.8, but proxy_cache (configuration is LiteSpeed+nginx) can stay mostly below 0.4.

Copyright © Windows knowledge All Rights Reserved