本文摘自PHP中文网,作者V,侵删。

问题描述:
新装了一台服务器,用nginx做代理。突然发现上传超过1M大的客户端文件无法正常上传,于是修改了下nginx的配置。
1 | cd /export/servers/nginx/conf/nginx.conf
|
在这个配置文件里面的server段里面的
1 2 3 4 5 | location / {
root html;
index index.html index.htm;
client_max_body_size 1000m;
}
|
加上了client_max_body_size 字段,怎么重启nginx都不行。后来在总配置文件里面发现了分配置文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
include domains/*; #########################分配置文件路径在此
# include domains/chat.local;
# include domains/chat.erp.com;
# include domains/support.chat.com;
# include douains/chat.com;
server {
listen 80;
server_name localhost;
|
include domains/*命令指定了分配置文件的路径。找到了分配置文件后,在分配置文件里面进行修改。分配置文件配置如下:
1 2 3 4 5 6 7 8 9 10 | server
{
listen 80;
server_name chat.erp.360buy.com;
#access_log /export/servers/nginx/logs/chat.erp.360buy.com;
location / {
proxy_pass http:
client_max_body_size 1000m;
}
}
|
用/export/servers/nginx/sbin/nginx -s reload重启下,上传文件的大小受限的问题就解决了。
推荐教程:nginx使用教程
以上就是通过修改nginx配置文件解决上传文件大小限制问题的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
nginx如何配置反向代理
你知道nginx怎样查看并发连接数么
编译过的nginx如何添加新模块
linux服务器如何安装nginx
nginx的优势是什么?
openresty nginx 区别
nginx流量拷贝功能介绍
nginx实现限流的方式有哪几种
nginx的请求如何处理?
nginx怎么打开
更多相关阅读请进入《nginx》频道 >>
转载请注明出处:木庄网络博客 » 通过修改nginx配置文件解决上传文件大小限制问题