出於某種原因,將client_max_body_size 16M;
放入我的nginx.conf文件中沒有任何影響 - 當我嘗試將圖像上傳到我的web服務器時,仍然收到HTTP 413錯誤。在每次更改配置文件後,我都重新啓動了Nginx,並且我試着將client_max_body_size
指令放在位置{}塊,服務器{}塊和http {}塊中。我甚至同時嘗試了這三種。Nginx忽略client_max_body_size
在四處尋找答案時,有人建議在其他配置文件中尋找client_max_body_size
行,如proxy.conf,我沒有。
我的Nginx的配置是沒有什麼特別的 - 只是上游化8080
我想上傳一個4.5MB JPG文件,運行Nginx的1.0.5上運行在端口一束彩虹(獨角獸)的連接Ubuntu 11.10。任何想法爲什麼這不起作用?
UPDATE:(?)
好像一個彩虹工人每30秒重新啓動。這裏是rainbows.stderr.log的輸出:
E, [2012-01-29T17:27:05.977487 #25218] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2012-01-29T17:27:05.978011 #25218] ERROR -- : retrying in 0.5 seconds (4 tries left)
E, [2012-01-29T17:27:06.478767 #25218] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2012-01-29T17:27:06.478964 #25218] ERROR -- : retrying in 0.5 seconds (3 tries left)
E, [2012-01-29T17:27:06.979509 #25218] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2012-01-29T17:27:06.979650 #25218] ERROR -- : retrying in 0.5 seconds (2 tries left)
E, [2012-01-29T17:27:07.480190 #25218] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2012-01-29T17:27:07.480353 #25218] ERROR -- : retrying in 0.5 seconds (1 tries left)
E, [2012-01-29T17:27:07.980809 #25218] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2012-01-29T17:27:07.980987 #25218] ERROR -- : retrying in 0.5 seconds (0 tries left)
E, [2012-01-29T17:27:08.481638 #25218] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
/usr/local/forrager/shared/bundle/ruby/1.9.1/gems/unicorn-4.1.1/lib/unicorn/socket_helper.rb:144:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
from /usr/local/forrager/shared/bundle/ruby/1.9.1/gems/unicorn-4.1.1/lib/unicorn/socket_helper.rb:144:in `new'
from /usr/local/forrager/shared/bundle/ruby/1.9.1/gems/unicorn-4.1.1/lib/unicorn/socket_helper.rb:144:in `bind_listen'
from /usr/local/forrager/shared/bundle/ruby/1.9.1/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:222:in `listen'
from /usr/local/forrager/shared/bundle/ruby/1.9.1/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:733:in `block in inherit_listeners!'
from /usr/local/forrager/shared/bundle/ruby/1.9.1/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:733:in `each'
from /usr/local/forrager/shared/bundle/ruby/1.9.1/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:733:in `inherit_listeners!'
from /usr/local/forrager/shared/bundle/ruby/1.9.1/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:121:in `start'
from /usr/local/forrager/shared/bundle/ruby/1.9.1/gems/rainbows-4.3.1/bin/rainbows:122:in `<top (required)>'
from /usr/local/forrager/shared/bundle/ruby/1.9.1/bin/rainbows:19:in `load'
from /usr/local/forrager/shared/bundle/ruby/1.9.1/bin/rainbows:19:in `<main>'
感謝您的回覆!/tmp的權限是777世界可寫的,我將Nginx配置更改爲僅在http {}下具有'client_max_body_size'。不幸的是,它仍然無法正常工作。在上傳過程中觀看/ tmp的'ls'不會顯示任何新創建的內容。我還可以檢查以確保Unicorn可以訪問/ tmp嗎? – Cameron 2012-01-29 08:43:40
檢查你可以自己發佈到獨角獸。將nginx從等式中取出一點。 Unicorn將自己呈現爲HTTP,因此可以直接訪問它。 – Lee 2012-01-29 08:50:09
嗯!好建議。我看到其他很奇怪的問題。在Chrome開發人員工具(直接連接到Unicorns)中查看請求/響應時,請求立即失敗,但實際上並未給出錯誤代碼。/add_image請求變成紅色,但好像失敗了一樣。還有一些其他的內容:顯示空白條目,只有標題信息,另一個看起來像base64編碼的PNG文件(我正在上傳一個jpg)。很奇怪。有沒有其他的獨角獸設置我錯過了? Sendfile或類似的東西? – Cameron 2012-01-29 09:04:00