[英]Proxy Apache Load Balancers to a Unix Socket instead of a port
我們如何在Apache中執行以下Nginx配置?
基本上代理到Unix套接字而不是負載平衡端口。
我希望Unicorn處理負載平衡而不是Apache。
upstream unicorn_server {
server unix:/home/prats/public_html/myapp/current/tmp/sockets/unicorn.sock
fail_timeout=0;
}
server {
...
...
...
location / {
...
...
# If you don't find the filename in the static files
# Then request it from the unicorn server
if (!-f $request_filename) {
proxy_pass http://unicorn_server;
break;
}
...
...
}
}
經過一段時間的搜索,我得出結論,通過套接字使用Apache2 + Unicorn是不可能的。 我得到的最遠的是在unicorn提供的套接字文件上使用mod_fastcgi,但是在嘗試訪問頁面時我得到了403 Forbidden。 似乎FastCGI需要與Unicorn使用的協議不同的協議。 如果你必須使用Unicorn和Apache,請堅持使用Mark Kolesar的解決方案。 請注意,您可能會遇到問題(來自http://rubyforge.org/pipermail/mongrel-unicorn/2011-July/001057.html ):
Apache + Unicorn仍然不受支持(據任何人都知道),它沒有完全緩沖響應和請求將Unicorn完全與慢客戶端的有害影響隔離開來。
ProxyRequests關閉
ProxyPass / stylesheets /!
ProxyPass / javascripts /!
ProxyPass / images /!
ProxyPass / http://example.com:8080/
ProxyPassReverse / http://example.com:8080/
你不能在中間使用unixcat嗎? 將proxypass發送到localhost:安裝xinetd + unixcat的東西/etc/xinetd.d/unicorn holding:
service livestatus
{
type = UNLISTED
port = someport
socket_type = stream
protocol = tcp
wait = no
cps = 100 3
instances = 500
per_source = 250
flags = NODELAY
user = someone
server = /usr/bin/unixcat
server_args = /var/run/unicorn/mysocket
only_from = 127.0.0.1
disable = no
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.