我在Windows 7旗艦版64位個人電腦上設置了Ruby on Rails應用程序。Windows 7 Ultimate 64位/ Mongrel/Apache 2.2
Mongrel的3個實例用於運行rails程序,它們由Apache 2.2進行負載平衡。我的httpd.conf文件
相關章節如下:
---------- httpd.conf
#define mongrel cluster
<proxy balancer://mongrelcluster>
BalancerMember http://127.0.0.1:3001
BalancerMember http://127.0.0.1:3002
BalancerMember http://127.0.0.1:3003
</proxy>
Listen 3009
#forward requests to mongrel cluster
<virtualhost *:3009>
ProxyPass/balancer://mongrelcluster/
ProxyPassReverse/balancer://mongrelcluster/
ProxyPreserveHost on
</virtualhost>
----------- httpd.conf
我可以在端口3001,3002和3003訪問本地主機單獨沒有問題。
當我嘗試通過Apache訪問端口3009上的本地主機時,出現「服務暫時不可用」 由於維護停機或容量問題,服務器暫時無法處理您的請求,請稍後重試。錯誤信息。
在檢查Apache的錯誤日誌:
---- Error log
[Tue Oct 04 12:46:37 2011] [notice] Child 6168: Child process is running
[Tue Oct 04 12:46:38 2011] [notice] Child 6168: Acquired the start mutex.
[Tue Oct 04 12:46:38 2011] [notice] Child 6168: Starting 64 worker threads.
[Tue Oct 04 12:46:38 2011] [notice] Child 3052: Released the start mutex
[Tue Oct 04 12:46:39 2011] [notice] Child 3052: All worker threads have exited.
[Tue Oct 04 12:46:39 2011] [notice] Child 3052: Child process is exiting
[Tue Oct 04 12:46:39 2011] [notice] Child 6168: Starting thread to listen on port 80.
[Tue Oct 04 12:46:39 2011] [notice] Child 6168: Starting thread to listen on port 3009.
[Tue Oct 04 12:46:46 2011] [error] (OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : proxy: HTTP: attempt to connect to 127.0.0.1:3001 (127.0.0.1) failed
[Tue Oct 04 12:46:46 2011] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
[Tue Oct 04 12:46:46 2011] [error] (OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : proxy: HTTP: attempt to connect to 127.0.0.1:3002 (127.0.0.1) failed
[Tue Oct 04 12:46:46 2011] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
[Tue Oct 04 12:46:46 2011] [error] (OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : proxy: HTTP: attempt to connect to 127.0.0.1:3003 (127.0.0.1) failed
[Tue Oct 04 12:46:46 2011] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
---- Error log
Apache的錯誤日誌顯示連接到雜種情況下莫名其妙地失敗了。
在我看來Windows 7的問題,因爲相同的設置在Windows XP系統上正常工作。
歡迎提出所有建議/提示/解決方案。
終於找到了答案。我必須從windows/system32/drivers/etc/hosts文件中刪除行「:: 1」。 – user977845