How to do nginx php without caching files?

10-16-2023

Settings for nginx php not to cache files: 1. Find and open the configuration file of nginx; 2. via location ~. *. (gif | jpg | JPEG | png | BMP | swf | js | CSS) $ {add _ headercache-controlno-store; } way to prohibit caching.

What if nginx php doesn't cache files?

Nginx disables the configuration of cache.

When debugging website programs, browser cache problems often occur, which makes the modification of front-end code ineffective. The cache can only be cleared after each forced refresh through Ctrl+F5. At this time, if nginx cache is disabled, it can reduce some minor troubles and make the browser go to the server to request files every time instead of reading cached files in the browser.

When the program is debugged and online, nginx cache can be opened, which can save the bandwidth flow of the server, reduce some requests and reduce the pressure on the server.

By configuring nginx's configuration file/usr/local/Nginx/conf/Nginx.conf, the switching effect can be achieved.

1. Enable caching

Location ~. *. (GIF | JPG | JPEG | PNG | BMP | SWF | JS | CSS) $ {# Sets the lifetime of caching the suffix file defined above to the browser, expires 3d; }

2. Disable caching

Location ~. *. (GIF | JPG | JPEG | PNG | BMP | SWF | JS | CSS) $ {# Caching is prohibited, and add _ header cache-control no-store is requested from the server every time; }

What are the characteristics of php? 1. Fast execution.

2. It has good openness and expansibility.

3. PHP supports a variety of mainstream and non-mainstream databases.

4. Object-oriented programming: PHP provides classes and objects.

5, the version update speed is fast.

6. It has rich functions.

7. Scalability.

8. Comprehensive functions, including graphic processing, encoding and decoding, compressed file processing, xml parsing, etc.

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us