apache伺服器設定了反向 Proxy後,運行一段時間就會莫名其妙的報後台伺服器暫時無法串連的錯誤,過幾秒鐘後又能自動回復,查看後發現apache的錯誤記錄檔中有如下字樣:[error] (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : proxy: HTTP: attempt to connect to localhost:8080 (localhost) failed[error] ap_proxy_connect_backend disabling worker for (host name) 此問題是由於windows環境下預設的tcp的maxuserport為5000,而使用了反向 Proxy則很可能很快耗盡了連接埠資源,一旦耗盡連接埠資源則產生os 10048錯誤,接著ap_proxy_connect_backend就自動重啟所有的線程。解決辦法是到註冊表中建立一個maxuserport鍵以修改此參數的預設值。以下是msdn上對於此參數的解釋:
MaxUserPort
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Data type |
Range |
Default value |
REG_DWORD |
5,000–65,534 ( port number ) |
5000 |
Description
Determines the highest port number TCP can assign when an application requests an available user port from the system. Typically, ephemeral ports (those used briefly) are allocated to port numbers 1024 through 5000.
Note
Windows 2000 does not add this entry to the registry. You can add it by editing the registry or by using a program that edits the registry.