我是第一次使用 Apache 和 Phusion Passenger 设置 Rails。我在 EC2 服务器上使用 Centos 6.5。我遵循了此教程使用 apache 和 Phusion Passenger 在服务器上启动 rails。
所有安装均成功,但是当我尝试访问域时,它只是继续加载。
我的 httpd.conf 文件更改:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.3/gems/passenger-5.0.21/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.2.3/gems/passenger-5.0.21
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.3/wrappers/ruby
</IfModule>
RackEnv development
<VirtualHost *:80>
ServerName app.llynkr.com
DocumentRoot /var/www/html/llynkr/public
<Directory /var/www/html/llynkr/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
我重新检查了我的公共目录,它是正确的。
我还检查了访问和错误日志。但无法确切地了解它的含义:
==> /var/log/httpd/error_log <==
[ 2015-11-30 18:55:41.0150 2971/7fcbccbfe7e0 age/Ust/UstRouterMain.cpp:317 ]: Passenger UstRouter online, PID 2971
[Mon Nov 30 18:55:41 2015] [notice] Digest: generating secret for digest authentication ...
[Mon Nov 30 18:55:41 2015] [notice] Digest: done
[ 2015-11-30 18:55:41.0924 2989/7f0d17c8d7e0 age/Wat/WatchdogMain.cpp:1276 ]: Starting Passenger watchdog...
[ 2015-11-30 18:55:41.1209 2992/7f9b58a5c7e0 age/Cor/CoreMain.cpp:957 ]: Starting Passenger core...
[ 2015-11-30 18:55:41.1212 2992/7f9b58a5c7e0 age/Cor/CoreMain.cpp:234 ]: Passenger core running in multi-application mode.
[ 2015-11-30 18:55:41.1234 2992/7f9b58a5c7e0 age/Cor/CoreMain.cpp:707 ]: Passenger core online, PID 2992
[ 2015-11-30 18:55:41.1460 2997/7f5a524d87e0 age/Ust/UstRouterMain.cpp:504 ]: Starting Passenger UstRouter...
[ 2015-11-30 18:55:41.1472 2997/7f5a524d87e0 age/Ust/UstRouterMain.cpp:317 ]: Passenger UstRouter online, PID 2997
[Mon Nov 30 18:55:41 2015] [notice] Apache/2.2.15 (Unix) DAV/2 Phusion_Passenger/5.0.21 configured -- resuming normal operations
==> /var/www/html/llynkr/log/development.log <==
==> /var/www/html/llynkr/log/production.log <==
==> /var/log/httpd/error_log <==
App 3030 stdout:
App 3052 stdout:
App 3064 stdout:
[ 2015-11-30 18:56:11.0450 2986/7f3e1f1e17e0 age/Wat/WatchdogMain.cpp:454 ]: Some Phusion Passenger agent processes did not exit in time, forcefully shutting down all.
我是否遗漏了配置中的某些步骤?
答案1
好的,我找到了解决方案,所以 EC2 的人们,如果您按照该教程操作,那么它不会涉及 SELinux。您需要禁用 SELinux。
只需编辑
/etc/selinux/config
并设置SELINUX=disabled
从 aws 控制台重启实例,然后检查。有时也可能因为 IPTables 而无法工作,因此只需添加以下内容即可启用端口 80
#-A INPUT -j REJECT --reject-with icmp-host-prohibited
#-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT