This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15131|Reply: 0

[Web] nginx sets up proxy caching

[Copy link]
Posted on 12/7/2016 2:25:58 PM | | | |
Practical application example: After the homepage of is visited by one person, it doesn't matter where the person is, Shanghai, Beijing, Shenzhen, or the United States. The caching period within 3 hours, people from all countries in the world visit the homepage of the website again, and they only access the front-end Y server, while the data server X does not have any burden and the database is 0 pressure. After 3 hours, the first person to visit the homepage will go to data server X to read the real-time data and query the database once, and then within 3 hours, everyone else's access will be read from the front-end server Y. In other words, within 24 hours a day, the homepage should theoretically only have 8 access records in the data server X (24 divided by 3 equals 8), and all other accesses, whether it is thousands, tens of thousands, or millions of homepage visits, are the affairs of the front-end server Y.
My profile, as follows:



Once we are set up, then look at the response header, as follows:



X-Cache-Status:MISS 这句话,表示,并没有从缓存里面读取数据,未命中的意思嘛。

Where does the problem arise? Is there a problem with the cache directory permissions that prevent writing to ???

Then, I modified the permissions of the cache directory, restarted nginx, and found that it still couldn't hit...

Finally, the solution is as follows:

Add the following sentence:
The complete configuration is as follows:


Attached is a screenshot of the hit:





Previous:Implementation: The nginx dynamic addition module has been installed
Next:pip execution error caused by python upgrade
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com