問(wèn)題描述:
新裝了一臺(tái)服務(wù)器,用nginx做代理。突然發(fā)現(xiàn)上傳超過(guò)1M大的客戶端文件無(wú)法正常上傳,于是修改了下nginx的配置。
cd /export/servers/nginx/conf/nginx.conf
在這個(gè)配置文件里面的server段里面的
location / { root html; index index.html index.htm; client_max_body_size 1000m; }
加上了client_max_body_size 字段,怎么重啟nginx都不行。后來(lái)在總配置文件里面發(fā)現(xiàn)了分配置文件:
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/*命令指定了分配置文件的路徑。找到了分配置文件后,在分配置文件里面進(jìn)行修改。分配置文件配置如下:
server { listen 80; server_name chat.erp.360buy.com; #access_log /export/servers/nginx/logs/chat.erp.360buy.com; location / { proxy_pass http://tomcat; client_max_body_size 1000m; } }
用/export/servers/nginx/sbin/nginx -s reload重啟下,上傳文件的大小受限的問(wèn)題就解決了。
推薦教程:nginx使用教程