nginx修改上傳文件大小限制


原文:http://blog.csdn.net/bruce128/article/details/9665503

新裝了一台服務器,用nginx做代理。突然發現上傳超過1M大的客戶端文件無法正常上傳,於是修改了下nginx的配置。

    cd /export/servers/nginx/conf/nginx.conf,在這個配置文件里面的server段里面的

 

location / {
            root   html;
            index  index.html index.htm;
   client_max_body_size    1000m;
  }

加上了client_max_body_size    字段,怎么重啟都不行。后來在總配置文件里面發現了分配置文件:

復制代碼
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/*命令指定了分配置文件的路徑。找到了分配置文件后,在分配置文件里面進行修改。分配置文件配置如下:

復制代碼
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    10m; #表示最大上傳10M,需要多大設置多大。
} }
復制代碼
 
        

service nginx restart

重啟下,上傳文件的大小受限的問題就解決了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM