当前位置:  开发笔记 > 编程语言 > 正文

如何增加Varnish 4和Nginx之间的超时

如何解决《如何增加Varnish4和Nginx之间的超时》经验,为你挑选了0个好方法。

在提出这个问题之前,我在谷歌和世界各地搜索了几个小时试图增加Varnish 4和Nginx之间的连接超时,但没有找到解决方案.

所以这是我的清漆配置:

backend web1 {
    .host = "192.168.1.21";
    .port = "80";
    .probe = {
        .request =
        "HEAD / HTTP/1.1"
        "Host: localhost"
        "Connection: close";

        .timeout = 1s;
        .interval = 5s;
        .window = 5;
        .threshold = 3;
    }
    .connect_timeout = 300s;
    .between_bytes_timeout = 300s;
}

这是Nginx配置:

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 0; # wait for 5 minutes before timeout the request

#       proxy_connect_timeout   60s;
#       proxy_send_timeout      300s;
#       proxy_read_timeout      300s;

        fastcgi_read_timeout    300s;

        types_hash_max_size 2048;
        # server_tokens off;

        client_body_buffer_size 20m; #Buffer of post request
        client_header_buffer_size 2k; #Buffer of headers
        client_max_body_size 40m; #Max post request size
        large_client_header_buffers 20 2k; #Max number and size of buffers of large requests

        server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;
        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
        ##
        # nginx-naxsi config
        ##
        # Uncomment it if you installed nginx-naxsi
        ##

        #include /etc/nginx/naxsi_core.rules;

        ##
        # nginx-passenger config
        ##
        # Uncomment it if you installed nginx-passenger
        ##

        #passenger_root /usr;
        #passenger_ruby /usr/bin/ruby;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

我尝试了所有参数但没有任何效果.

当我设置keepalive_timeout为300s时,如果我直接访问它,超时设置为300s(5分钟),但是当我通过Varnish访问时,超时设置为60s.所以我禁用了Nginx keepalive_timeout并将其设置为0,但遇到了同样的问题.

怎么了?

如何增加Varnish和Nginx之间的超时?

推荐阅读
谢谢巷议
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有