gpt4 book ai didi

ruby-on-rails - 让 Rails 生产在端口 80 上运行

转载 作者:行者123 更新时间:2023-12-04 18:32:18 25 4
gpt4 key购买 nike

我正在尝试让我的 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,我可能会缺少什么?

提前谢谢了。

最佳答案

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

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

gem install passenger 

在编译 Apache 模块之前,还需要安装两个依赖包:
apt-get install curl-devel httpd-devel 

使用此命令启动 apache 安装:这将需要一些时间
passenger-install-apache2-module

乘客会在 Apache 之后显示一些内容安装:

跟进并在 中进行更改(/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

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

关于ruby-on-rails - 让 Rails 生产在端口 80 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27644070/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com