【发布时间】:2014-06-10 23:50:19
【问题描述】:
我使用 Openshift、Haproxy、Ruby on Rails 和 Postgresql 作为后端。我已成功部署所有内容,但 Haproxy 无法将 HTTP 请求发送到我的 rails 应用程序的根路径。
app-root/logs/haproxy.log
[ALERT] 114/053517 (469622) : proxy 'express' has no server available!
[WARNING] server express/local-gear is DOWN, reason: Layer7 wrong status, code: 404
app-root/logs/haproxy_ctld.log
ERROR -- : Could not connect to the application. Check if the application is stopped.
app-root/logs/ruby.log
"OPTIONS /products HTTP/1.0" 404 1351 "-" "-"
routes.rb
root :to => 'products#index'
haproxy.cfg
global
maxconn 4096
stats socket /var/lib/{ID}/haproxy//run/stats level admin
defaults
log global
mode http
option httplog
option dontlognull
option http-server-close
retries 3
option redispatch
maxconn 128
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
listen stats xxx.xxx.xxx.131:8080
mode http
stats enable
stats uri /
listen express xxx.xxx.xxx.130:8080
cookie GEAR insert indirect nocache
option httpchk /
balance leastconn
server local-gear xxx.xxx.xxx.129:8080 check fall 2 rise 3 inter 200 cookie local-{APP_ID}
我已删除公用文件夹 (Rails) 中的 index.html。但是,当我再次将 index.html 文件添加到公用文件夹时,一切正常,我可以在以下位置访问我的应用程序:app_name-appdomain.rhcloud.com/products 这并不完美,因为我想在不将 /products 添加到 URL 的情况下访问它。
感谢您的帮助! 如果您需要有关设置的更多详细信息,请告诉我
干杯!
【问题讨论】:
-
我也试过:选项 httpchk /products
-
so.. 你找到解决方案了吗?
-
我在使用 nodejs 应用时遇到了同样的问题。
-
你还有同样的问题吗?你修好了吗?
-
很抱歉回答得太晚了,但我无法解决问题。
标签: ruby-on-rails ruby openshift haproxy