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;
            }       
        }
    
  • 相关阅读:
    Google Chart API 阮一峰的网络日志
    PHP随机函数【上】
    php实现socket推送技术
    javascript变量作用域
    如何使用jqplot描绘一个简单的线形图?
    培训小记
    Google自己的浏览器GoogleChrome
    这大半年的回顾
    一个高手的SQL求工作天数的函数
    关于TSQL中数据库重命名
  • 原文地址:https://www.cnblogs.com/liuzhanghao/p/13328886.html
Copyright © 2011-2022 走看看