浏览器出现413 Request Entity Too Large错误解决方法

一般进入前端服务器,对nginx的配置文件进行修改,然后重启nginx服务器

server {
        listen       80;
        server_name  www.baidu.com.

    client_max_body_size 20m; //增加的一行,或者修改该值
    location / {
          root /home/app/nginx/html/merch-web;
          index index.html;
      try_files $uri $uri/ /index.html;
        }
       
    location /assets {
      root /home/app/nginx/html;
        }
 
        location ^~/api {
    
       proxy_set_header Access-Control-Allow-Origin '*';
           proxy_set_header MerchV1Token $http_MerchV1Token;
       proxy_pass http://api_service/;
           proxy_set_header Host  $http_host;
           proxy_set_header Connection close;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-Server $host;
    }
}

猜你喜欢

转载自blog.csdn.net/m0_37708405/article/details/81702489