首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >从上游读取响应头时,上游超时(110:连接超时),客户端: 66.38.32.24,服务器: xxxx.com,请求:

从上游读取响应头时,上游超时(110:连接超时),客户端: 66.38.32.24,服务器: xxxx.com,请求:
EN

Stack Overflow用户
提问于 2017-05-22 16:43:34
回答 2查看 2.3K关注 0票数 0

我的服务器经常出现超时问题,我调整了fastcg_read_timeoutproxy_read_timeout等参数,但没有解决我的问题。在我的xxxx.conf下面查找

代码语言:javascript
运行
AI代码解释
复制
server {
server_name www.xxxx.com;
return 301 $scheme://xxxx.com$request_uri;
}

server {
    ## Your website name goes here.
    server_name xxxx.com;

    ## Your only path reference.
    root /var/www/xxxx.com;


 # This should be in your http block and if it is, it's not needed here.
    index index.html index.php;

    error_log    /var/log/nginx/xxxx.com-error.log;
    access_log   /var/log/nginx/xxxx.com-access.log;


    # Body size (max upload)
    #    client_max_body_size 64m;
    #    client_body_buffer_size 2m;



    location = /favicon.ico {
            log_not_found off;
            access_log off;
    }
 location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
    }

    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
    location ~ /\. {
        deny all;
    }

    # Deny access to any files with a .php extension in the uploads directory
    # Works in sub-directory installs and also in multisite network
    # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
    location ~* /(?:uploads|files)/.*\.php$ {
        deny all;
    }

    location / {
            # This is cool because no php is touched for static content
            try_files $uri $uri/ /index.php?$args;
            # This to stop connection timeout
            proxy_http_version 1.1;
            proxy_set_header Connection "";
           # Time-out Settings
            proxy_send_timeout   150;
            proxy_read_timeout   150;
    }


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


    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
    }}
EN

回答 2

Stack Overflow用户

发布于 2017-05-23 09:31:19

在我本地的nginx机器上开发时,我遇到了同样的问题。

经过广泛的研究,我找到了问题的解决方案(不幸的是,我再也找不到这篇文章了)。

您可以尝试更改以下内容:

代码语言:javascript
运行
AI代码解释
复制
fastcgi_pass_unix: localhost:9000;

然后运行'sudo service nginx reload‘。

这为我解决了这个问题。希望对你来说也是如此。

票数 0
EN

Stack Overflow用户

发布于 2017-05-26 13:21:16

这个问题为我解决了。我对proxy_send_timeout、proxy_read_timeout和fastcgi_read_timeout进行了注释,但在下面的代码中保留了proxy_http_version和proxy_set_header。

代码语言:javascript
运行
AI代码解释
复制
 location / {

        proxy_http_version 1.1;
        proxy_set_header Connection "";

      #  proxy_send_timeout   150;
      #  proxy_read_timeout   150;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44118131

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档