在項目部署的時候,遇到一個問題, 就是上傳文件的時候報錯 http 請求報 413 Request Entity Too Large錯誤。
后來發先是nginx中未設置 請求體大小。
server {
listen 80;
server_name localhost;
charset utf-8;
# nginx 配置客戶端請求體最大值多少M
client_max_body_size 5M;
location / {
root /home/record/lb-project/lb-vue;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /admin/ {
root /home/record/lb-project/lb-admin-vue;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:9088/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}