最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

設(shè)置Nginx允許上傳文件的大小的代碼詳解

 更新時(shí)間:2024年01月11日 11:55:49   作者:毛小zhu  
這篇文章主要給大家介紹了關(guān)于設(shè)置Nginx允許上傳文件的大小的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)Nginx有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)吧

1、Nginx官方文檔說(shuō)明:

Syntax: client_max_body_size size;
 
Default: client_max_body_size 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.

client_max_body_size 用來(lái)修改允許客戶端上傳文件的大小。默認(rèn)為1m,如果設(shè)置為0,表示上傳文件大小不受限制。

可以在以下模塊設(shè)置: http, server, location 

 client_max_body_size 10m;

2、設(shè)置參數(shù)

1)、在 server 模塊中設(shè)置

server {
    listen       80;
    server_name  localhost;
    #charset koi8-r;
 
    # client_max_body_size 用來(lái)修改允許客戶端上傳文件的大小。默認(rèn)為1m,如果設(shè)置為0,表示上傳文件大小不受限制。
    # 可以在以下模塊設(shè)置: http, server, location 
    client_max_body_size 10m;
 
    # 訪問(wèn) / 網(wǎng)站跟目錄返回的內(nèi)容
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
    
    ...
}

2)、在 http 模塊中設(shè)置

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
 
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
 
    sendfile        on;
    #tcp_nopush     on;
 
    keepalive_timeout  65;
 
    # 是否開啟壓縮功能
    #gzip  on;
 
    # client_max_body_size 用來(lái)修改允許客戶端上傳文件的大小。默認(rèn)為1m,如果設(shè)置為0,表示上傳文件大小不受限制。
    # 可以在以下模塊設(shè)置: http, server, location 
    client_max_body_size 10m;
    
    
 
 
    # 引用配置文件
    include /etc/nginx/conf.d/*.conf;
}

以上就是設(shè)置Nginx允許上傳文件的大小的方法詳解的詳細(xì)內(nèi)容,更多關(guān)于設(shè)置Nginx上傳文件的大小的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評(píng)論

东城区| 惠东县| 兰坪| 西乌珠穆沁旗| 芦山县| 敦煌市| 呼和浩特市| 慈利县| 普格县| 马山县| 保靖县| 无极县| 屯昌县| 兴国县| 泰顺县| 江安县| 锦屏县| 蓝山县| 商水县| 通州区| 灵宝市| 施秉县| 来凤县| 特克斯县| 松潘县| 凭祥市| 静宁县| 云林县| 四子王旗| 陇西县| 眉山市| 黄龙县| 湟源县| 沙田区| 弥渡县| 武清区| 丰城市| 威海市| 时尚| 大庆市| 荔浦县|