Home  >  Q&A  >  body text

When requesting static resources from nginx, will nginx still submit it to php-fpm for processing?

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梦2712 days ago472

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 17:27:01

    It must not be the case. The route you configure ends with .php. That’s where you go.

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 17:27:01

    The location + static file module is generally configured in the nginx configuration file

    reply
    0
  • Cancelreply