在Debian 8.6虚拟机 – 服务器块(虚拟主机)问题上设置nginx 1.10.1

大家好,问候。 首先感谢您抽出宝贵的时间来回顾并回答我的问题。 非常感谢。

或多或less,我正在使用新的虚拟机(Google Cloud Computing)设置所有设置,并尝试使用Debian,nginx,mariadb,php。

我已经在虚拟机上多次尝试过这种types的设置,但是这次我决定在使用apt-get的时候得到最新版本的nginx(1.10.1)而不是Debian的默认软件包安装nginx而不更新源列表。 (我相信一个就像1.6.3)。

虽然两者之间的差异是最小的,但我注意到的一件事是这个版本的nginx不使用服务器块(Vhosts)的/ sites-enabled /和/ sites-available /文件夹,它直接进入/ etc / nginx / conf.d /文件夹。 没问题,我想。

现在我的情况是我正在工作的网站organiplan点com显示404页面没有find,尽pipe它似乎像我的服务器块和nginx.conf文件安装正确。 我将在下面包括。

服务器块

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; } 

尽pipeindex.php和index.html文件都位于指定的根目录,但仍然显示404未find。 我知道我一定会错过一些非常明显的东西,但是我一直没有弄明白。 甚至抹去了服务器,并重新安装了一切,以确保我没有搞砸了,我没有注意到和相同的结果。

先进的感谢提供的任何帮助。 对此,我真的非常感激。

编辑

对不起,我不知道为什么我不想在最初的post中包含错误日志。 下面你会findnginx的error.log和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 

错误日志说,访问PHP的权限是不正确的。 解决这个问题,我希望事情能够开始工作,除非没有其他错误configuration。

build议您查看PHP套接字的path,用户,组和权限。 它真的在下面的path。 用户Nginx是否具有该path的权限?

 /var/run/php5-fpm.sock