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;
            }       
        }
    
  • 相关阅读:
    二叉查找树详解
    探索推荐引擎内部的秘密
    个性化推荐漫谈
    网站的可扩展架构
    网站伸缩性架构--数据存储服务器集群的伸缩性设计
    SQL Server 分组后取Top N
    SQL SERVER 查询特定的前几条数据
    数据库的事务处理必须满足ACID原则,ACID分别是指什么
    String在JAVA里是固定长度的吗?为什么可用“+”连接
    怎样取得数组对象和arralist 的长度
  • 原文地址:https://www.cnblogs.com/liuzhanghao/p/13328886.html
Copyright © 2011-2022 走看看