簡體   English   中英

apache + proxy_fcgi_module + php-fpm:大型POST有效負載為空

[英]apache + proxy_fcgi_module + php-fpm: Large POST Payload empty

我在我的Web服務器上將apache 2.4.10與proxy_fcgi一起與php-fpm(7.0.29)結合使用。

<IfModule proxy_fcgi_module>
  <FilesMatch ".+\.ph(p[3457]?|t|tml)$">
    SetHandler "proxy:unix:/var/www/xxx/php/php7.0-fpm.sock|fcgi://localhost"
  </FilesMatch>
</IfModule>

當我發送具有較大有效負載(> 1MB)的POST請求時,在Apache的錯誤日志中得到以下行

[Fri Apr 06 15:33:51 2018] [proxy_fcgi:error] [pid 24162:tid (32)Broken pipe: [client 84.63.x.x:37536] AH01075: Error dispatching request to : (sending stdin), referer: -, request: /index.php, querystring: -

從我的stdin中讀取時,在我的PHP代碼中,我得到了一個空的有效負載:

$payload =file_get_contents('php://input');

一切都以較小的有效負載工作。 任何想法有什么問題嗎? 我找不到proxy_fcgi的任何限制設置...

感謝幫助!

我現在發現問題出在分塊傳輸(Transfer-Encoding:分塊)上,其中沒有發送內容長度標題。 mod_proxy_fcgi似乎無法正確支持該功能。

因此,唯一可能的解決方案似乎是使用直接在apache進程內運行而不是通過FastCGI或切換到NginX的mod_php ...

閱讀本文以獲取更多信息: https : //www.jeffgeerling.com/blog/2017/apache-fastcgi-proxyfcgi-and-empty-post-bodies-chunked-transfer

另一個解決方法似乎是強制使用不支持分塊傳輸的協議HTTP / 1.0,從而迫使客戶端在一個請求中發送整個數據。 但這-在我的情況下-破壞了git客戶端中的TLS握手。

當我使用PHP腳本代理Git服務器時,對我來說,解決方案是提高git客戶端的http緩沖區,直到能夠切換到NginX。

git config http.postBuffer 524288000

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM