Silicon Valley nginx tutorial-6 nginx configuration example-dynamic and static separation

Nginx dynamic and static separation is simply to separate dynamic and static requests, and it cannot be understood that knowledge simply separates dynamic pages from static pages. Strictly consciously, it should be separated from static requests dynamically, which can be understood as using nginx to process static pages and tomcat to process dynamic pages. At present, dynamic and static separation is roughly divided into two types from the perspective of implementation:

  • One is purely to separate static files into separate domain names and put them on separate servers, which is also the current mainstream respected solution.
  • The other is to mix dynamic and static files and publish them, separated by nginx: specify different suffix names by location to achieve different request forwarding, and set the expires parameter, you can use the browser cache expiration time to reduce the number of servers. Requests and traffic. Specific Expires definition: It is to set an expiration time for a resource, that is to say, without going to the server to verify, it can be directly confirmed through the browser itself whether it is expired, so no additional traffic will be generated. This method is ideal for resources that change infrequently. (If you frequently update files, Expire is not recommended to cache). If you set 3d, it means accessing the URL within 3 days and sending a request to check whether the last update time of the file on the server has changed. If there is no change, it will not be fetched from the server, and the status code 304 will be returned; if there is a modification, it will be downloaded directly from the server and returned to the status 200.

Guess you like

Origin www.cnblogs.com/csj2018/p/12675987.html