在将Ubuntu更新为16之后,我一直在整理我遇到的一些错误。该网站在升级之前运行良好(正在运行Drupal)。 Nginx -t返回语法没问题且测试成功。从备份中恢复也无法解决问题。
以下是Nginx conf
server {
server_name example.com;
root /usr/share/nginx/html/drupal/;
index index.html index.htm index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
allow 192.168.0.0/16;
deny all;
}
location ~ \..*/.*\.php$ {
return 403;
}
location ~ sites/default/files/.*php {
return 403;
}
location ~ ^/sites/.*/private/ {
return 403;
}
# Allow "Well-Known URIs" as per RFC 5785
location ~* ^/.well-known/ {
allow all;
}
# Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
}
location / {
try_files $uri /index.php?$query_string;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~* /sites/.*/files/styles/ {
access_log off;
expires 30d;
try_files $uri @rewrite;
}
# Don't allow direct access to PHP files in the vendor directory.
location ~ /vendor/.*\.php$ {
deny all;
return 404;
}
location ~ '\.php$|^/update.php' {
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_intercept_errors on;
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
}
location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
我的错误日志显示如下
[error] 14933#14933: *1320 connect() failed (111: Connection refused) while connecting to upstream, client: 11.111.11.111, server: website.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "website.com"
curl -i website.com返回
HTTP/1.1 502 Bad Gateway
Server: nginx/1.10.3 (Ubuntu)
Date: Tue, 03 Oct 2017 02:21:29 GMT
Content-Type: text/html
Content-Length: 182
Connection: keep-alive
Nginx状态返回以下
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset:
enabled)
Active: active (running) since Mon 2017-10-02 22:07:47 EDT; 18min ago
Process: 25609 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 25039 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s
reload (code=exited, status=0/SUCCESS)
Process: 25612 ExecStart=/usr/sbin/nginx -g daemon on; master_process on;
(code=exited, status=0/SUCCESS)
Process: 25611 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 25615 (nginx)
CGroup: /system.slice/nginx.service
├─25615 nginx: master process /usr/sbin/nginx -g daemon on;
master_process on
└─25616 nginx: worker process
Oct 02 22:07:47 ubuntu systemd[1]: Stopped A high performance web
server and a reverse proxy server.
Oct 02 22:07:47 ubuntu systemd[1]: Starting A high performance web
server and a reverse proxy server...
Oct 02 22:07:47 ubuntu systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Oct 02 22:07:47 ubuntu-1gb systemd[1]: Started A high performance web
server and a reverse proxy server.
服务PHP5-FPM状态返回以下
● php5-fpm.service - LSB: starts php5-fpm
Loaded: loaded (/etc/init.d/php5-fpm; bad; vendor preset: enabled)
Active: active (exited) since Mon 2017-10-02 21:00:13 EDT; 1h 28min ago
Docs: man:systemd-sysv-generator(8)
Process: 24934 ExecStop=/etc/init.d/php5-fpm stop (code=exited,
status=0/SUCCESS)
Process: 25598 ExecReload=/etc/init.d/php5-fpm reload (code=exited,
status=0/SUCCESS)
Process: 24936 ExecStart=/etc/init.d/php5-fpm start (code=exited,
status=0/SUCCESS)
Oct 02 21:03:08 ubuntu systemd[1]: Reloading LSB: starts php5-fpm.
Oct 02 21:03:08 ubuntu systemd[1]: Reloaded LSB: starts php5-fpm.
Oct 02 22:05:36 ubuntu systemd[1]: Reloading LSB: starts php5-fpm.
Oct 02 22:05:36 ubuntu systemd[1]: Reloaded LSB: starts php5-fpm.
Oct 02 22:06:30 ubuntu systemd[1]: Reloading LSB: starts php5-fpm.
Oct 02 22:06:30 ubuntu systemd[1]: Reloaded LSB: starts php5-fpm.
Oct 02 22:07:10 ubuntu systemd[1]: Reloading LSB: starts php5-fpm.
Oct 02 22:07:10 ubuntu systemd[1]: Reloaded LSB: starts php5-fpm.
Oct 02 22:07:46 ubuntu systemd[1]: Reloading LSB: starts php5-fpm.
Oct 02 22:07:46 ubuntu systemd[1]: Reloaded LSB: starts php5-fpm.
非常感谢任何帮助
由于