使用橡胶我用resque和redis硫化了我现有的项目。我已全部部署。点击web_tools索引显示一个Resque链接。但点击它给了我一个404如何设置橡胶+ resque_web + nginx
我想通nginx的不知道该怎么用“/ resque”这样做,我添加的文件config/rubber/role/web_tools/resque-nginx.conf
有:
<% if resque_host = rubber_instances.for_role('resque_web').first %>
<%
@path = "/etc/nginx/rubber/tools/resque.conf"
%>
location /resque
{
proxy_pass http://<%= resque_host.full_name %>:<%= rubber_env.resque_web_port %>;
}
<% end %>
基本上复制HAProxy的-nginx的。 conf文件来自同一个目录。
我的第一个问题是 - 我为什么要做这个?硫化应该做到这一点还是我已经做错了?
继续前进。这个nginx配置不起作用。但我有点进一步,至少我现在正在打WEBrick服务器。我有一个页面,说:
Sinatra doesn’t know this ditty.
所以我改变了我的配置思想,Resque的使用WEBrick服务器不知道是什么/ resque是:
location /resque
{
rewrite ^/resque/(.*) /$1 break;
proxy_pass http://<%= resque_host.full_name %>:<%= rubber_env.resque_web_port %>;
}
这工作,但只有当我手动去https://myhost.com/resque/overview
(Rubber添加到工具索引页面的链接仅为/resque
)。但是,resque网页上的所有其他链接(包括任何CSS和.js文件)现在都已损坏,因为链接不以resque/
开头。换句话说,Working的链接只是/working
,但它需要/resque/working
让nginx知道如何处理它。
我试过其他的东西,如摆脱重写和更改索引页面指向resque/overview
,但仍然给我“Sinatra不知道这个小调”页面。
我已经试过:
location /resque
{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://<%= resque_host.full_name %>:<%= rubber_env.resque_web_port %>;
}
我得到的 “西纳特拉...小曲” 页面时,我打/resque
或/resque/overview
。
然后我说改写回:
location /resque
{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
rewrite ^/resque/(.*) /$1 break;
proxy_pass http://<%= resque_host.full_name %>:<%= rubber_env.resque_web_port %>;
}
这是相同的结果为不具有所有代理的调用。
有谁知道如何让nginx的和Resque web服务器很好地协同工作?
太棒了!谢谢,尼克。我也会+1你的拉请求。我们最终在本地做的其他改变是摆脱美洲狮,并使用机架(在resque-web-upstart.conf中),因为美洲狮是不必要的。 – pcg79