nginx设置超时时间

前言:

	nginx默认请求时间是60s,在特殊的情况下个别的请求时间会超过60秒,比如在进行复杂的硬件操作或重复多
次的硬件操作的时候,就会超过60s,超时会报错。
	通过配置nginx配置文件可以修改默认的超时时间:

nginx配置:(以下配置文件经过脱敏,拿自己想要的即可)

server {
        listen       *:65531;
        server_name  0.0.0.0;

        error_log   stderr warn;
        access_log  stdout main;
        proxy_send_timeout 180s;     # 设置发送超时时间,
        proxy_read_timeout 180s;	 # 设置读取超时时间。

        location ^~/apig/ {
          client_max_body_size                    "100m";
          proxy_pass https://localhost:8086/;
        }

        location / {
            root   /opt/ty/console;
            index  index.html index.htm;
        }

        location = /index.html {
            root   /opt/ty/console;
            index  index.html index.htm;
            add_header Cache-Control "no-cache, no-store";
        }

        error_page  404              /;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }





Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐