日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

上傳文件出現 413 Request Entity Too Large

作者:? 杰尼龜 更新時間: 2022-02-13 編程語言

可以選擇在http{ }中設置:client_max_body_size 200m;
可以選擇在server{ }中設置:client_max_body_size 200m;
還可以選擇在location{ }中設置:client_max_body_size 200m;
三者有區別設置到http{}內,
控制全局nginx所有請求報文大小設置到server{}內,
控制該server的所有請求報文大小設置到location{}內,控制滿足該路由規則的請求報文大小
然后重啟nginx
/etc/init.d/nginx restart

server {
    listen       8083;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /workspace/dist;
        index  index.html index.htm;
		try_files $uri $uri/ /index.html;
    }

    location /api/ {
       add_header 'Access-Control-Allow-Origin' '*';
       add_header 'Access-Control-Allow-Methods' 'POST,GET,OPTIONS';
       add_header 'Access-Control-Allow-Headers' 'Authorization';
       proxy_pass http://127.0.0.1:8093/api/;
    }

    location /ws/ {
       proxy_set_header X-Real_IP $remote_addr;
       proxy_set_header Host $host;
       proxy_set_header X_Forward_For $proxy_add_x_forwarded_for;
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection 'upgrade';
       proxy_pass http://127.0.0.1:8091/;
    } 

    location /images/ {
	root /workspace/static/platform;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
    }

    location /excel/ {
	root /workspace/static/platform;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
    }


    location /engine/ {
	root /workspace/static;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    client_max_body_size 20m;

}

原文鏈接:https://blog.csdn.net/weixin_45124380/article/details/121404719

欄目分類
最近更新