新手问题 Apache + Passenger 部署问题

yu3h40 · 2014年12月27日 · 最后由 gazeldx 回复于 2015年01月22日 · 2086 次阅读

rvm ruby 2.2.0 sinatra

#简要描述:# ##访问时 preloader 没有正常加载## ###An error occurred while starting up the preloader: it did not write a startup response in time.### ###访问后在等待超时的过程中。访问 4567 端口正常显示出应用。###

最基本的 hello world 可以正常部署 就像这样 `# my_app.rb require 'sinatra/base'

class MyApp < Sinatra::Base # ... app code here ... get '/' do 'Hello world!' end # start the server if ruby file executed directly run! if app_file == $0 end`

# config.ru require './my_app' run MyApp 访问时正常出现 Hello world

但是自己的 sinatra 应用访问时出现 passenger 的错误页,并且等待很久才会出现 Web application could not be started [2014-12-27 13:45:45] INFO WEBrick 1.3.1 [2014-12-27 13:45:45] INFO ruby 2.2.0 (2014-12-25) [x86_64-linux] == Sinatra/1.4.5 has taken the stage on 4567 for production with backup from WEBrick [2014-12-27 13:45:45] INFO WEBrick::HTTPServer#start: pid=6345 port=4567

没有访问时查看端口是这样的 [root@localhost ~]# netstat -apn|grep 4567 [root@localhost ~]# lsof -i:4567 [root@localhost ~]# 然后访问,一直在等待的过程中。 [root@localhost ~]# lsof -i:4567 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ruby 6551 nobody 7u IPv4 60206 0t0 TCP *:tram (LISTEN) [root@localhost ~]# netstat -apn|grep 4567 tcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 6551/ruby [root@localhost ~]# 并且在这个过程中在 VPS 上 curl localhost:4567 可以正常访问 本机上访问 4567 端口也正常显示应用

猜想是因为 firewall 的原因,但如果只是由于 firewall,为什么最基本的 hellowold 可以正常访问

如果因为我自己的应用的话为什么 rackup 可以正常访问

在访问远端应用的过程中。在 VPS 上 4567 端口是打开的 并且 curl localhost:4567 正确的 不访问的时候 4567 端口是关闭的。。

折腾两天了。。。求救

端口号值太小了。改成 62136 试试。我在 coding 上发布也出现类似问题,结果用默认的端口就好了。 cloud-fondary 对 Sinatra 项目做了特别处理了。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号