從理論上講,你可以簡單地使用IP:ADDR而不是套接字路徑:
socket: 127.0.0.1:3000
會工作。但是,如果您使用多個精簡進程,則會遇到問題。考慮到IO等待時間,甚至可能會有更高的進程數量,因爲CPU核心的數量也是可能的。)(這很可能是因爲整個ruby是單線程的。
不知何故,瘦配置解釋器的套接字地址解碼器足夠智能地使用普通IP地址,但它增加了IP而不是增加了其他套接字的端口。因此,你將有多個實例薄監聽
# thin will listen on these addresses
127.0.0.1:3000
127.0.0.2:3000
127.0.0.3:3000
127.0.0.4:3000
,而他們將在
# it would be okay, but not this happens
127.0.0.1:3000
127.0.0.1:3001
127.0.0.1:3002
127.0.0.1:3003
在聽這超現實的行爲很可能不是你想要的。 (儘管如果你在所有的IP上都有活動接口,它可以工作。)
但是,這個ruby的東西有一個很好的特性,就是在它的命令行選項和配置文件選項之間有一個直接的分配。並且一個thin --help
命令將顯示給你。您可以強制執行TCP使用address
和port
選擇聽:
#socket: /srv/cica/tmp/thin.sock
address: 127.0.0.1
port: 3000
所以,你會找到一些正確的結果。
默認值是0.0.0.0
和3000
。
由於apache想要代理只有一個單一的TCP端口與其最常見的設置(ProxyPass
,ProxyPassReverse
指令),也需要一些小小的欺騙,負載平衡代理羣集。相關的配置代碼片段:
<Proxy balancer://cicas>
BalancerMember http://localhost:3000 disablereuse=On route=cica1
BalancerMember http://localhost:3001 disablereuse=On route=cica2
BalancerMember http://localhost:3002 disablereuse=On route=cica3
BalancerMember http://localhost:3003 disablereuse=On route=cica4
ProxySet lbmethod=byrequests
</Proxy>
ProxyPass/balancer://cicas/