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.
必须不会啊 ,你配置的路由是.php结尾的才走那里
nginx配置文件中一般都会配置location + 静态文件模块