出现此问题有可能的原因
- 目录权限:根目录权限和访问文件的权限
- Nginx中root配置的位置
以前出现过第一种原因导致的File not found
,这次出现是第二个原因,在此记录下。
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name www..test.com;
root /mnt/php/blog; #这里一时疏忽给干掉了,只留下了location节点里的root,原因在此
include /etc/nginx/default.d/*.conf;
location / {
root /mnt/php/test;
index index.php index.html;
try_files $uri $uri/ /index.php?$query_string;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}