2013-02-18 91 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> 
相关问题