[英]“page not found nginx/1.4.4” errors on every page except homepage
我几乎在每个页面上都遇到“找不到页面”错误。 我在Google上进行了搜索,结果显示nginx的URL_rewrite可能有问题。
我已经像这样更改了nginx/conf/nginx.config.default
location / {
root html;
index index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
但仍然无法正常工作。
服务器系统:Centos 7 Nginx:1.4.4 PHP版本:5.5.7
我已经像这样更改了nginx / conf / nginx.config.default
似乎该文件是原始配置文件,而不是正常工作的文件,请尝试查找不带.default
扩展名的nginx.config
文件。
如果找不到,请尝试将默认值复制到名称为nginx.config
的新文件中
您需要做的第一件事是在文档根目录中创建两个文件。
第一个调用test.html,并在文件中编写以下内容:
这是一个测验
然后创建一个名为test.php的文件,其中包含以下内容:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
像浏览器一样浏览到每个浏览器
http://example.com/test.html和http://example.com/test.php
我的猜测是html会加载,而php不会。
这是由于php和nginx对文件没有正确的权限。
首先是执行以下命令:
chown -R nginx:nginx文档根
并继续执行该命令,向每个音色添加/ *,直到出现错误。
在您的nginx.conf文件中,您需要确保具有以下内容:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
然后转到/etc/php-fpm.d/www.conf
并确保对此进行以下设置:
listen.owner = nginx
listen.group = nginx
这应该可以解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.