I'm getting "page not found" errors on nearly every page. I searched Google, where it was suggested that there could be something wrong with nginx's URL_rewrite.
I have already changed nginx/conf/nginx.config.default
like this
location / {
root html;
index index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
but it's still not working.
Server system: Centos 7 nginx: 1.4.4 PHP version: 5.5.7
I have already changed nginx/conf/nginx.config.default like this
Seems that file is the original config file not the file that work, try to find nginx.config
file without the .default
extension.
If u did not find it try to copy the default in a new file with name nginx.config
The first thing you need to do is in your document root create two files.
The first one call test.html and in the file write the following:
This is a test
Then create one called test.php with the following in it:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
Navigate to each on your browser like
http://example.com/test.html and http://example.com/test.php
My guess is that the html will load and the php wont.
This is due to php and nginx not having the correct permissions for the files.
First thing is to do the following command:
chown -R nginx:nginx documentroot
And keep doing that command adding /* each timne until you get an error.
In your nginx.conf file you need to ensure you have the following:
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;
}
Then go to /etc/php-fpm.d/www.conf
and ensure the following are set to this:
listen.owner = nginx
listen.group = nginx
This should fix the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.