"page not found nginx/1.4.4" 除主页外的所有页面都存在错误
"page not found nginx/1.4.4" errors on every page except homepage
我几乎在每一页上都遇到 "page not found" 错误。我搜索了 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
I have already changed nginx/conf/nginx.config.default like this
这个文件好像是原来的配置文件,不是能用的文件,试试找
nginx.config
没有 .default
扩展名的文件。
如果您没有找到它,请尝试将默认值复制到名称为 nginx.config
的新文件中
您需要做的第一件事是在您的文档根目录中创建两个文件。
第一个调用 test.html 并在文件中写入以下内容:
This is a test
然后创建一个名为 test.php 的文件,其中包含以下内容:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
像
一样在浏览器上导航到每个
http://example.com/test.html and http://example.com/test.php
我的猜测是 html 会加载而 php 不会加载。
这是由于 php 和 nginx 没有正确的文件权限。
首先是执行以下命令:
chown -R nginx:nginx documentroot
并继续执行该命令,每次添加 /* 直到出现错误。
在您的 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
这应该可以解决问题。
我几乎在每一页上都遇到 "page not found" 错误。我搜索了 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
I have already changed nginx/conf/nginx.config.default like this
这个文件好像是原来的配置文件,不是能用的文件,试试找
nginx.config
没有 .default
扩展名的文件。
如果您没有找到它,请尝试将默认值复制到名称为 nginx.config
您需要做的第一件事是在您的文档根目录中创建两个文件。
第一个调用 test.html 并在文件中写入以下内容:
This is a test
然后创建一个名为 test.php 的文件,其中包含以下内容:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
像
一样在浏览器上导航到每个http://example.com/test.html and http://example.com/test.php
我的猜测是 html 会加载而 php 不会加载。
这是由于 php 和 nginx 没有正确的文件权限。
首先是执行以下命令:
chown -R nginx:nginx documentroot
并继续执行该命令,每次添加 /* 直到出现错误。
在您的 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
这应该可以解决问题。