如图:

原因:nginx限制了请求大小,默认是1M,超出限制会出现413错误

修改:client_max_body_size 100m;

server {
        listen 3001;
        server_name 127.0.0.1;
        proxy_cache nginx;
        proxy_cache_valid  301 302 20m;
        proxy_cache_valid any 5m;
        location / {
            proxy_pass      http://127.0.0.1:2001;
            client_max_body_size 100m;
            gzip on;
            gzip_min_length 1k;
            gzip_buffers 4 16k;
            #gzip_http_version 1.0;
            gzip_comp_level 2;
            gzip_types text/plain application/json application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
            gzip_vary off;
            gzip_disable "MSIE [1-6]\.";

            #缓存设置
            proxy_ignore_headers Set-Cookie Cache-Control;
            proxy_hide_header Cache-Control;
            proxy_hide_header Set-Cookie;
            proxy_set_header Host $proxy_host:$proxy_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            add_header X-Via $server_addr;
            add_header X-Upstream $upstream_addr;
            add_header  Nginx-Cache $upstream_cache_status;
        }

    }

 

posted on 2021-12-20 19:31  周文豪  阅读(309)  评论(0编辑  收藏  举报