自己搭的服務器,用nginx做代理。上傳超過1M大的客戶端文件無法正常上傳,nginx直接報錯,上傳文件太大,於是修改了下nginx的配置,就可以了。
按照網上所說的加上client_max_body_size 字段,怎么重啟nginx都不行。后來發現放的位置有問題!
server { listen 80; server_name localhost; client_max_body_size 10M; location /web { alias D:/web; index main.html; } location /web/service { proxy_pass http://192.168.1.188:8080/service; } location /web/service/upload { proxy_pass http://192.168.1.188/upload; } }
client_max_body_size 10M 必須要放在server下的server_name下,而不是放在localhost /web的大括號里。
nginx修改上傳文件大小限制
nginx訪問日志的默認路徑
/var/log/nginx