For example, when I request a static resource such as txt, img, css, and js. Will nginx still hand this request over to php-fpm for processing?
Note that the requested resource URL corresponds to the root directory of the website one-to-one, and there is no rewriting or other circumstances.
If yes, please tell me how to optimize
My impression is that it won’t. Only when there is fastcgi_pass 127.0.0.1:9000;
in the location
block, it will be submitted to php-fpm, for example:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /Library/WebServer/Documents/wordpress/$fastcgi_script_name;
include fastcgi_params;
}
Let me ask a question and confirm whether this is the case.
It must not be the case. The route you configure ends with .php. That’s where you go.
The location + static file module is generally configured in the nginx configuration file