【问题标题】:Getting Rails production to run on port 80让 Rails 生产在端口 80 上运行
【发布时间】:2015-02-22 23:52:45
【问题描述】:

我正在尝试让我的 rails 应用程序在生产模式下运行,但我遇到了一些困难。

我正在使用带有 apache 的乘客,并且正在运行 Ubuntu 12.04。我已经配置和创建了我的生产数据库,并设置了乘客。状态如下:

$ rvmsudo passenger-status 
Version : 4.0.56
Date    : 2014-12-25 01:54:20 +0000
Instance: 7264
----------- General information -----------
Max pool size : 6
Processes     : 0
Requests in top-level queue : 0

----------- Application groups -----------

但是,当我运行 rails server -e production 时,它仍然在端口 3000 上侦听,如下所示:

$ rails server -e production
=> Booting WEBrick
=> Rails 4.2.0 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-12-25 01:54:49] INFO  WEBrick 1.3.1
[2014-12-25 01:54:49] INFO  ruby 2.1.5 (2014-11-13) [i686-linux]
[2014-12-25 01:54:49] INFO  WEBrick::HTTPServer#start: pid=7459 port=3000

为了让它在生产模式下监听端口 80,我可能缺少什么?

非常感谢。

【问题讨论】:

  • rails server -e production -p 80

标签: ruby-on-rails apache ubuntu passenger


【解决方案1】:

我认为这不是您必须使用 Apache 在生产环境中启动服务器的方式。您是否安装了 apache-paassenger 模块?并在 apache conf 文件中进行了更改?

首先需要在系统上安装gem:

gem install passenger 

在编译Apache模块之前,还需要安装两个依赖包:

apt-get install curl-devel httpd-devel 

使用此命令启动 apache 安装:需要一些时间

passenger-install-apache2-module

Apache 安装后,Passenger 会显示一些内容:

跟进并在(/etc/httpd/conf/httpd.conf)中进行更改

您必须指向应用程序公用文件夹并重新启动 apache 服务器,并密切关注这些来源。

https://www.digitalocean.com/community/tutorials/how-to-install-rails-apache-and-mysql-on-ubuntu-with-passenger

https://www.digitalocean.com/community/tutorials/how-to-setup-a-rails-4-app-with-apache-and-passenger-on-centos-6

当我第一次这样做时,它很有帮助。

【讨论】:

    猜你喜欢
    • 2013-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-16
    • 2013-01-27
    • 1970-01-01
    • 2011-11-13
    • 2012-02-12
    相关资源
    最近更新 更多