I am getting File not found error with nginx and i have been trying to
fix
this for hours.The config look similar to what i use on other sites but
i
don’t know why it doesn’t work.html files works fine thought.index.php
location is /home/servergreek.com/public_html/www/index.php.Thanks for
helping me out.My Nginx version : 1.7.8 & php version is PHP 5.5.20
(cli)
(built: Dec 10 2014 14:03:09)
server {
listen 80;
server_name servergreek.com 167.88.125.157;
return 301 http://www.servergreek.com$request_uri;
}
server {
listen 80 default_server;
server_name www.servergreek.com;
access_log /home/servergreek.com/public_html/logs/access_log main;
error_log /home/servergreek.com/public_html/logs/error_log crit;
root /home/servergreek.com/public_html/www;
index index.php index.html index.htm;
Have you checked your php-fpm settings and log file? I’m getting a
“X-Powered-By: PHP…” header which indicates nginx is corrrectly
sending
the request to php-fpm.
Also I believe you don’t really need to set root again inside the
“location” blocks since it’s already set in it’s “server” parent block.
I fixed it … but for that i had to change my document root setup
when i was using /home/servergreek.com/public_html/www i got “no input
file
specified”(although the directory existed and had index.php in it).Then
i
did a server reinstall again but i choose
/var/www/servergreek.com/public_html/www . But why the
/home/servregreek.com/public_html/www didn’t worked?
Btw i created both directory as shown (i did no chown on either on them)
mkdir -p /var/www/servergreek.com/public_html/www -worked
mkdir -p /home/servergreek.com/public_html/www - didn’t worked
Is an extra step required when using directories outside /var/www ?
On Sun, Dec 14, 2014 at 11:20:22PM -0500, khav wrote:
Hi there,
mkdir -p /var/www/servergreek.com/public_html/www -worked
mkdir -p /home/servergreek.com/public_html/www - didn’t worked
Is an extra step required when using directories outside /var/www ?
Your nginx server runs as once user/group. Your php server runs as
one user/group.
If you look at the output of each of
ls -ld /
ls -ld /var
ls -ld /var/www
ls -ld /var/www/servergreek.com
ls -ld /var/www/servergreek.com/public_html
ls -ld /var/www/servergreek.com/public_html/www
ls -ld /home
ls -ld /home/servergreek.com
ls -ld /home/servergreek.com/public_html
ls -ld /home/servergreek.com/public_html/www
are any of them different from the others? Particularly between the
“working” and “not working” set, and probably in the last of the ten
fields that probably have “drwx” as the first four.
If the user/group running nginx is unable to access a file, it will lead
to an error. If the user/group running php is unable to access a file,
it will lead to an error.