Access denied (403) for PHP files with Nginx + PHP-FPM

后端 未结 7 1629
孤街浪徒
孤街浪徒 2020-12-13 04:58

I have been spending few hours on that issue and despite the high number of posts related to it, I cannot solve it. I have a Fedora 20 box with Nginx + PHP-FPM that worked q

7条回答
  •  醉梦人生
    2020-12-13 05:12

    Here are some possible solutions:

    1. In your php-fpm www.conf set security.limit_extensions to .php or .php5 or whatever suits your environment. For some users, completely removing all values or setting it to FALSE was the only way to get it working.

    2. In your nginx config file set fastcgi_pass to your socket address (e.g. unix:/var/run/php-fpm/php-fpm.sock;) instead of your server address and port.

    3. Check your SCRIPT_FILENAME fastcgi param and set it according to the location of your files.

    4. In your nginx config file include fastcgi_split_path_info ^(.+\.php)(/.+)$; in the location block where all the other fastcgi params are defined.

    5. In your php.ini set cgi.fix_pathinfo to 1

提交回复
热议问题