本文主要和大家分享nginx如何修改上传文件大小,自己搭的服务器,用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做代理。上传超过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如何修改上传文件大小的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号