403 Forbidden occurs when the folder name in the tp5 nginx static directory is php

as mentioned, 403 Forbidden appears to access .php files under static directory named php, but other file formats such as html and js are normal, and all files whose folder name is not php are accessed normally (including php files)

nging configuration file is as follows

server {
  listen 80;
  server_name xxx.xxx.com;
  -sharpaccess_log /data/wwwlogs/xxx.xxxx.log combined;
  -sharperror_log /data/wwwlogs/xxx.xxxxx_error.log;

  set $root /data/www/tp5/public;

  location ~ \.php {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param    SCRIPT_FILENAME    $root$fastcgi_script_name;
        include        fastcgi_params;
    }
    location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
    {
        root $root;
    }
    location / {
        root    $root;
        index    index.html index.php;
        if ( -f $request_filename) {
            break;
        }
        if ( !-e $request_filename) {
            rewrite ^(.*)$ /index.php/$1 last;
            break;
        }
    }


}

clipboard.png

clipboard.png

clipboard.png

Apr.24,2022

should be a matter of directory permissions. Change the read and write permission of the public directory to 777

Menu