![504 网关超时错误 - 上游读取响应标头时超时](https://linux22.com/image/716094/504%20%E7%BD%91%E5%85%B3%E8%B6%85%E6%97%B6%E9%94%99%E8%AF%AF%20-%20%E4%B8%8A%E6%B8%B8%E8%AF%BB%E5%8F%96%E5%93%8D%E5%BA%94%E6%A0%87%E5%A4%B4%E6%97%B6%E8%B6%85%E6%97%B6.png)
我将运行 Ubuntu 14.04 的 vagrant 上的 nginx 1.11 和 PHP 7.1 升级到 nginx 1.13.1 和 PHP 7.2。
确认两项服务均已运行。
现在,当我尝试访问任何example.test
网站时,什么都没有发生。浏览器只是无限期地等待加载,直到最终出现错误504 Gateway Time-out
,并显示在“”中:
2018/01/14 23:51:55 [error] 3058#3058: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.10.1, server: example.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock", host: "192.168.10.10"
访问example.test
不起作用,并且192.168.10.10
它映射到我的主机上也不起作用。
我/var/log/nginx/error.log
只看到这个:
2018/01/14 23:41:55 [notice] 3052#3052: signal process started
我/var/log/nginx/example.test-access.log
只看到这个:
192.168.10.1 - - [14/Jan/2018:23:42:04 +0000] "GET / HTTP/1.1" 499 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
我的/etc/nginx/sites-enabled/example.test
配置文件包含:
server {
listen 80;
listen 443 ssl;
server_name example.test;
root "/home/vagrant/Projects/example.test/public";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log /var/log/nginx/example.test-access.log;
error_log /var/log/nginx/example.test-error.log error;
sendfile off;
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 32k;
fastcgi_buffers 16 32k;
fastcgi_connect_timeout 600;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
}
location ~ /\.ht {
deny all;
}
ssl_certificate /etc/nginx/ssl/example.test.crt;
ssl_certificate_key /etc/nginx/ssl/example.test.key;
}
什么原因造成这里的挂断?