1

Hello and greetings everyone. First and foremost thank you for taking the time out of your day to review and possibly respond to my question. It is greatly appreciated.

More or less I'm getting everything setup on a new virtual machine (Google Cloud Computing) and trying to go with Debian, nginx, mariadb, php.

I've whipped up this type of setup on a virtual machine many times in the passed, but this time I decided to get the most updated version of nginx (1.10.1) rather than the default package with Debian when I type apt-get install nginx without updating the source list. (I believe that one is like 1.6.3).

While the differences between the two are minimal, one thing I noticed is this version of nginx doesn't use the /sites-enabled/ and /sites-available/ folders for the server blocks (Vhosts), it just goes directly to the /etc/nginx/conf.d/ folder. No problem, I thought.

Now my situation is the site I'm working on organiplan dot com is showing a 404 page not found, despite it seems like my server block and nginx.conf file are setup properly. I'll include both below.

Server Block

 server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

root /var/www/html/organiplan.com/public_html;
index index.php index.html index.htm;

server_name organiplan.com www.organiplan.com;

client_max_body_size 1024m;

location / {
try_files $uri $uri/ /index.php?q=$request_uri;
   }

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
    root /usr/share/nginx/html;
   }

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
   }
}

nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
worker_connections  1024;
}


http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

keepalive_timeout  65;

#gzip  on;

include /etc/nginx/conf.d/*.conf;
}

Despite having both an index.php and index.html file located in the specified root directory, it continues to show a 404 not found. I know I must be missing something dreadfully obvious but I haven't been able to figure it out. Even wiped the server and reinstalled everything to make sure I didn't mess something up I didn't notice and same result.

Thanks in advanced for any help provided. I really appreciate it.

Edit

Sorry, I don't know why I didn't think to include the error logs during the initial post. Below you'll find the nginx error.log and the php5-fpm.log

nginx error.log

[error] 26954#26954: *86 open() "/usr/share/nginx/www/50x.html" failed (2:   No such file or directory), client: 66.249.64.66, server: organiplan.com,  request: "GET /tag/php/feed/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5- fpm.sock", host: "organiplan.com"
2016/09/21 00:21:27 [crit] 26954#26954: *89 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 66.249.64.125, server: organiplan.com, request: "GET /tag/tag/feed/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "organiplan.com"
2016/09/21 00:21:27 [error] 26954#26954: *89 open() "/usr/share/nginx/www/50x.html" failed (2: No such file or directory), client: 66.249.64.125, server: organiplan.com, request: "GET /tag/tag/feed/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "organiplan.com"

php5-fpm.log

20-Sep-2016 17:33:41] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf     test is successful

[20-Sep-2016 17:33:42] NOTICE: fpm is running, pid 22891
[20-Sep-2016 17:33:42] NOTICE: ready to handle connections
[20-Sep-2016 17:33:42] NOTICE: systemd monitor interval set to 10000ms
[20-Sep-2016 17:33:49] NOTICE: Terminating ...
[20-Sep-2016 17:33:49] NOTICE: exiting, bye-bye!
[20-Sep-2016 17:33:49] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf          test is successful

[20-Sep-2016 17:33:49] NOTICE: fpm is running, pid 23151
[20-Sep-2016 17:33:49] NOTICE: ready to handle connections
[20-Sep-2016 17:33:49] NOTICE: systemd monitor interval set to 10000ms 
[20-Sep-2016 17:33:50] NOTICE: Terminating ...
[20-Sep-2016 17:33:50] NOTICE: exiting, bye-bye!
[20-Sep-2016 17:33:50] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[20-Sep-2016 17:33:50] NOTICE: fpm is running, pid 23431
[20-Sep-2016 17:33:50] NOTICE: ready to handle connections
[20-Sep-2016 17:33:50] NOTICE: systemd monitor interval set to 10000ms
Gary
  • 11
  • 2

1 Answers1

2

The error log says that permissions to access PHP are incorrect. Fix that and I expect things will start working, subject to there being no other misconfigurations.

Suggest you look at path, users, groups and permissions for the PHP socket. Is it really at the path below. Does the user Nginx is running as have permissions for that path?

/var/run/php5-fpm.sock
Tim
  • 31,888
  • 7
  • 52
  • 78