我在我的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