When requesting static resources from nginx, will nginx still submit it to php-fpm for processing?
过去多啦不再A梦
过去多啦不再A梦 2017-05-16 17:25:01
0
2
506

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.

过去多啦不再A梦
过去多啦不再A梦

reply all(2)
洪涛

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template