2013-02-18 71 views
1

我有一個導軌應用程序...我安裝鏈:nginx +乘客和運行軌道服務器。但我的問題是,在瀏覽器中我必須設置網址,如:Rails +乘客+ nginx運行的應用程序與URL無:端口

page.com:3000 

但如何只page.com使用?

我不能運行命令的用戶限制passenger start -e=development -p=80 ....

我的nginx的conf文件是這樣的:

server { 
     listen  80; 
     server_name localhost; 

     #charset koi8-r; 
     #root /home/prog/OnlineAuto/Shop/public; 
     #passenger_enabled on; 
     #access_log logs/host.access.log main; 
     location/{ 
       root /home/prog/OnlineAuto/Shop/public; 
       index index.html index.htm; 
       passenger_enabled on; 
     } 

     #error_page 404    /404.html; 

     # redirect server error pages to the static page /50x.html 
     # 
     error_page 500 502 503 504 /50x.html; 
     location = /50x.html { 
      root html; 
     } 
} 

所以,我怎麼能得到我的rails通過域名應用,而無需任何端口? (但在3000端口上運行rails服務器)

回答

0

您正嘗試在Nginx使用的端口上啓動Passenger,這很可能就是爲什麼會出現錯誤。

我對Unicorn更加熟悉,但基於我讀過的文檔,您不必在單獨的過程中啓動Passenger。 Passenger正確安裝後,我認爲你只需要Nginx指令就可以工作。

配置您的passenger_root和passenger_ruby在HTTP塊nginx.conf,然後

http { 
    passenger_root /<path_to_passenger_install>; 
    passenger_ruby /usr/local/bin/ruby; 

    server { 
    listen 80; 
    server_name page.com; 
    charset utf-8; 
    root /www/page.com/public; 
    passenger_enabled on; 
    rails_spawn_method smart; 
    rails_env development; 
    } 
} 
+0

沒有(沒有幫助 – brabertaser19 2013-02-18 15:35:12

+0

路徑公共我通過PWD – brabertaser19 2013-02-18 15:36:11

+0

讓你有從nginx的任何錯誤日誌,你可以分享?您使用? – 2013-02-18 15:41:57

0

如果你在這裏使用的乘客是什麼,我不得不用得到它的工作www.mysite.com上,而不使用萬維網。 mysite.com:80 CentOS的服務器上:

在等/的httpd/conf下的關鍵是要取消對了NameVirtualHost *:80和改變*到我的服務器的IP地址。確保Listen 80未註釋。還要將您的IP添加到VirtualHost標籤。它必須在端口80上運行,而不是8080或您選擇的某個端口。

NameVirtualHost xx.xx.xx.xx:80 

Listen 80 

<VirtualHost xx.xx.xx.xx:80> 
    ServerName www.mysite.com 
    # !!! Be sure to point DocumentRoot to 'public'! 
    DocumentRoot /var/www/vhosts/mysite.com/httpdocs/public/ 
    <Directory /var/www/vhosts/mysite.com/httpdocs/public/> 
     # This relaxes Apache security settings. 
     AllowOverride all 
     # MultiViews must be turned off. 
     Options -MultiViews 
    </Directory> 
</VirtualHost> 
相關問題