我在我的nginx服務器中有starnge問題,php文件在子文件夾下拋出404
錯誤,但是html文件工作正常。Nginx的php:php文件在子目錄下拋出404錯誤
文件夾結構
html<folder>
index.php
test<folder>
test.php //not working
test.html //works fine
Nginx的配置
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /var/www/html;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
}ml
當訪問<ip-address>/test/test.html
工作正常
當訪問<ip-address>/test/test.php
404錯誤。
當訪問<ip-address>
工作正常(指向html/index.php
文件)。
我已經在html文件夾中添加了權限,在php.ini文件中也啓用cgi.fix_pathinfo=0
。
可能更適合https://serverfault.com/。 – jhmckimm