2013-03-13 61 views
0

我一直在使用Thin & Heroku(Cedar)來開發我的Rails 3應用程序,但是我已經切換到Unicorn以便使PDFKit能夠正常工作。爲什麼Unicorn不在本地主機上提供頁面?

Heroku's instructions,我已經創建了我的第一次Procfile在我的應用程序的根目錄,並賦予了它這樣的內容:

web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb 

當我在命令行中鍵入foreman start,我得到:

14:31:46 web.1 | started with pid 699 
14:31:48 web.1 | I, [2013-03-13T14:31:48.544196 #699] INFO -- : Refreshing Gem list 
14:31:55 web.1 | I, [2013-03-13T14:31:55.736480 #699] INFO -- : listening on addr=0.0.0.0:5000 fd=13 
14:31:55 web.1 | I, [2013-03-13T14:31:55.740045 #699] INFO -- : master process ready 
14:31:55 web.1 | I, [2013-03-13T14:31:55.899544 #712] INFO -- : worker=1 ready 
14:31:55 web.1 | I, [2013-03-13T14:31:55.900740 #711] INFO -- : worker=0 ready 
14:31:55 web.1 | I, [2013-03-13T14:31:55.911041 #713] INFO -- : worker=2 ready 

如果我在瀏覽器中嘗試加載localhost:3000,領班輸出下面沒有任何內容出現,瀏覽器顯示:「糟糕!Google Chrome無法連接到localhost:3000。」

看來Unicorn根本沒有使用Port3000,因爲在運行時我仍然可以通過輸入rails server來啓動Thin,當我這樣做時,我可以再次在瀏覽器中加載localhost:3000

怎麼回事,我該如何解決?

回答

6

劃痕。我現在可以看到獨角獸發佈到localhost:5000。要使其使用localhost:3000,請將.foreman文件稱爲port: 3000位於您的應用程序的根目錄下。

0

你可以在端口3000

unicorn_rails --config-file config/unicorn.rb -p 3000 
啓動麒麟
相關問題