相关疑难解决方法(0)

Nginx反向代理导致504网关超时

我使用Nginx作为反向代理,接受请求,然后执行proxy_pass从端口8001上运行的上游服务器获取实际的Web应用程序.

如果我去mywebsite.com或做一个wget,我会在60秒后获得504网关超时...但是,如果我加载mywebsite.com:8001,应用程序会按预期加载!

因此有些事情阻止了Nginx与上游服务器的通信.

所有这一切都是在我的托管公司重置机器运行之后开始的,之前没有任何问题.

这是我的vhosts服务器块:

server {
    listen   80;
    server_name mywebsite.com;

    root /home/user/public_html/mywebsite.com/public;

    access_log /home/user/public_html/mywebsite.com/log/access.log upstreamlog;
    error_log /home/user/public_html/mywebsite.com/log/error.log;

    location / {
        proxy_pass http://xxx.xxx.xxx.xxx:8001;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
} 
Run Code Online (Sandbox Code Playgroud)

我的Nginx错误日志输出:

2014/06/27 13:10:58 [error] 31406#0: *1 upstream timed out (110: Connection timed out) while connecting to upstream, client: xxx.xx.xxx.xxx, server: mywebsite.com, request: "GET / HTTP/1.1", upstream: "http://xxx.xxx.xxx.xxx:8001/", host: "mywebsite.com"
Run Code Online (Sandbox Code Playgroud)

reverse-proxy nginx proxypass http-status-code-504

103
推荐指数
6
解决办法
16万
查看次数

Nginx + PHP-FPM 7.1 - 504网关超时

我在synology nas上运行nginx 1.12和php-fpm 7.1作为单独的docker容器,如果php脚本运行时间超过60s,我会得到504 Gateway错误.我已经尝试了几个nginx配置参数,但错误仍然存​​在.

这是我的实际nginx配置:

#user  www-data;
#group http
worker_processes  1;

error_log  /opt/data/logs/nginx_error.log notice;

events {
    worker_connections  1024;
}

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

    #keepalive_timeout 30s;
    sendfile on;
    #tcp_nopush off;
    tcp_nodelay on;

    #gzip  off;

    send_timeout 300

    server {
        listen       80;
        server_name  "";

        root   /opt/php;
        index  index.php;

        location /data/ {
           sendfile        on;
           root   /opt;
        }

        location ~ \.php$ {

            include fastcgi_params;

            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            if (!-f $document_root$fastcgi_script_name) {
                return 404;
            }

            # Mitigate https://httpoxy.org/ vulnerabilities
            fastcgi_param HTTP_PROXY "";

            fastcgi_pass   php:9000; …
Run Code Online (Sandbox Code Playgroud)

php synology docker

13
推荐指数
1
解决办法
1万
查看次数