=======
說明篇
=======
之前基於nusoap搭好的nginx+php的webservice服務(http://blog.csdn.net/linvo/article/details/9109963),在和java那邊調試的時候出錯
java那邊get wsdl時正常,post調用服務後報 “No namespace on "html" element” 錯誤,查了nginx log,發現nginx返回411錯誤
HTTP的411狀態具體就不多說了,這裡說下針對Nginx的情況:
nginx給出的官方解釋有三種情況會引發nginx彈411回去
1、client sent invalid “Content-Length” header
2、client sent … method without “Content-Length” header
3、client sent “Transfer-Encoding: chunked” header
感覺像是第二種,但是最後我的解決方案卻是:
為Nginx增加了HttpChunkinModule模組!
========
安裝篇
========
安裝前先看下當前Nginx的模組配置資訊(例如):
/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.0.15
TLS SNI support disabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
下載chunkin-nginx-module(https://github.com/agentzh/chunkin-nginx-module/tags)並解壓
重新編譯Nginx,configure增加參數 --add-module=/root/chunkin-nginx-module-0.23/ (視情況設定此處模組的源碼目錄)
make -j2
make install
Nginx設定檔server中增加如下參數:
server { chunkin on; error_page 411 = @my_411_error; location @my_411_error { chunkin_resume; } ……
重啟Nginx,OK
----------------------------------- 我是分割線 --------------------------------------
相關連結:
http://blog.chinaunix.net/uid-16974460-id-296023.html
http://www.l99.com/1548156/blog/view/283241
http://wiki.nginx.org/HttpChunkinModule