zoukankan      html  css  js  c++  java
  • 72.nginx文件配置

    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;
            }       
        }
    
  • 相关阅读:
    抓取到的网页写入数据库后是乱码的解决方法
    关于SecureCRT v7.0.2.418 安装、破解和修改
    负数的除法和取模运算(Python 2.7和C的比较)
    单模式匹配匹配算法
    Python解析网页工具:PyQuery
    asp.net json,对象,字符串的相互转换
    asp.net 后台 get,post请求
    查看局域网内所有IP
    MSSql性能优化
    js中对象复制以及apply方法的使用
  • 原文地址:https://www.cnblogs.com/liuzhanghao/p/13328886.html
Copyright © 2011-2022 走看看