[英]Deploy ruby on rails app with passenger and apache
我想在Red Hat Enterprise Linux Server 6.5版服务器上将我的ruby on rails应用程序部署在我上面,请执行以下操作:
服务器版本:Apache / 2.2.15(Unix)
rvm安装ruby
宝石安装导轨
宝石安装乘客
passenger-install-apache2-模块
然后我在httpd.conf文件中添加了以下行
LoadModule passenger_module /home/myname/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.50/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/myname/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.50
PassengerDefaultRuby /home/myname/.rvm/gems/ruby-2.1.2/wrappers/ruby
</IfModule>
我将以下内容添加到我的httpd.conf中
<VirtualHost *:80>
ServerName www.whatever.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/whatever/public
<Directory /var/www/whatever/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
附加信息 RVM 1.25.31
我重新启动了httpd,但是我看不到我的应用程序在我购买了域名并将其重定向到计算机IP的what.com上运行。 怎么了?
您需要取消注释下面指示的行并重新启动apache服务( sudo service apache2 restart
或类似的sudo /etc/init.d/apache2 restart
)。
<VirtualHost *:80>
ServerName www.whatever.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/whatever/public
<Directory /var/www/whatever/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
---> Require all granted
</Directory>
这是乘客默认物品的常见问题。 您可能使用的是新版本的apache
,这意味着#如果您使用的是Apache> = 2.4,请取消注释此注释:将适用。
发生这种情况的原因有很多,@ user1876128出现了一些内部网络问题,并不是由于故障而导致的。
为了使此apache设置正常工作,您的网络需要允许http通信进入服务器盒的端口80。
还建议允许端口3000上的流量,因此您可以在同一地址(加上:3000)上运行Rails开发服务器,以在更改前检查所有更改。
您可以通过以下方式登录大多数家用路由器:将浏览器指向192.168.0.1或192.168.1.1,然后使用密码(该密码写在路由器上,或者您可以在线找到默认密码,或者已经更改了密码) )。 并为端口80和服务器盒设置服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.