首页 > 其他 > 详细

72.nginx文件配置

时间:2020-07-17 12:54:49      阅读:49      评论:0      收藏:0      [点我收藏+]

1.nginx上传文件:

1)
Syntax:	client_max_body_size size;
Default:	client_max_body_size 1m;  # 默认值1m代销
Context:	http, server, location   # 可以配置的范围
Sets the maximum allowed size of the client request body, specified in the “Content-Length” request header field. If the size in a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client. Please be aware that browsers cannot correctly display this error. Setting size to 0 disables checking of client request body size.  # 最后一句话很关键,设置为0之后就不显示客户端上传大小,同时记住超过限制之后的报错信息可能会显示其他报错信息,比如跨域报错等等

client_max_body_size 1024M; 上传文件大小限制

2)
Syntax:	keepalive_timeout timeout [header_timeout];  # 连接保持时间
Default:	keepalive_timeout 75s;   # 默认75秒钟,但是一般都会调的比较小,特殊网站除外
Context:	http, server, location
The first parameter sets a timeout during which a keep-alive client connection will stay open on the server side. The zero value disables keep-alive client connections. The optional second parameter sets a value in the “Keep-Alive: timeout=time” response header field. Two parameters may differ.
    
keepalive_timeout 1800;保持连接的时间,默认65s

3)
sendfile on; 设置为on表示启动高效传输文件的模式   # DMA表示直接存储访问
# https://blog.csdn.net/zhusixun/article/details/81702380    关于sendfile拷贝文件

4)
server {
        listen       80;
        server_name  localhost;
        location /web {
            alias   D:/web;
            index main.html; 
            client_max_body_size 10M;
        }
        location /web/service {
            proxy_pass   http://192.168.1.188:8080/service;     
        }
        location /web/service/upload {
            proxy_pass   http://192.168.1.188/upload;
        }       
    }

72.nginx文件配置

原文:https://www.cnblogs.com/liuzhanghao/p/13328886.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!