nginx 超时问题 - 解决方法

nginx.conf 配置模板:

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

    keepalive_timeout  120s;
  
    server {
        listen       80;
        server_name  localhost;
        ################################## 1
        keepalive_timeout  600s;
        ################################## 2
        large_client_header_buffers 4 16k;     # 读取大型客户端请求头的缓冲区的最大数量和大小
		client_max_body_size 200M;     #设置nginx能处理的最大请求主体大小。
		client_body_buffer_size 200M;  #请求主体的缓冲区大小。 
		#################################
        charset     utf-8;

        location / {
	    proxy_pass  http://localhost:8080/;
	    ################################# 3
        proxy_read_timeout 1200s;
        proxy_send_timeout 1200s; 
		#################################
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }
}

配置 1:长链接配置

        ################################## 1
        keepalive_timeout  600s;
        ################################## 2

配置 2:文件传输大小配置

        ################################## 2
        large_client_header_buffers 4 16k;     # 读取大型客户端请求头的缓冲区的最大数量和大小
		client_max_body_size 200M;     #设置nginx能处理的最大请求主体大小。
		client_body_buffer_size 200M;  #请求主体的缓冲区大小。 
		#################################

配置 3:等待时间配置

	    ################################# 3
        proxy_read_timeout 1200s;
        proxy_send_timeout 1200s; 
		#################################

你可能感兴趣的:(Nginx,nginx,运维)