我对Ruby on Rails非常陌生,对于Amazon EC2也是全新的。我能够使用CentOS 6.5在Linode上设置RoR,Passenger和Apache,使用这里找到的指示:https://www.rosehosting.com/blog/install-ruby-on-rails-with-apache-and-passenger-on-centos-6/在Centos 6.5上安装带有Passenger的Ruby on Rails亚马逊EC2
一切工作正常,我能够得到它并运行没有问题。但我的客户使用亚马逊EC2,所以我必须在其服务器上进行设置。当它试图在Amazon EC2上,一旦我得到的rvmsudo passenger-install-apache2-module
的一部分,我得到以下错误:
It looks like you are on a Red Hat or CentOS operating system, with SELinux
enabled. SELinux is a security mechanism for which special Passenger-specific
configuration is required. We supply this configuration as part of
our Passenger RPMs.
However, Passenger is currently installed through gem or tarball and does not
include any SELinux configuration. Therefore, we recommend that you:
1. Uninstall your current Passenger install.
2. Reinstall Passenger through the RPMs that we provide:
https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#installing_or_upgrading_on_red_hat
我也跟着在提供的URL的步骤,但它仍然给了我同样的错误。我禁用了SELinux,然后再次运行上面的命令,我得到一个错误,说没有足够的交换空间。我运行下面的命令,因为它说:
sudo dd if=/dev/zero of=/swap bs=1M count=1024
sudo mkswap /swap
sudo swapon /swap
运行之后,我能够运行rvmsudo passenger-install-apache2-module
,并成功安装。正如它所说,我在httpd.conf中添加了这些行,并重新启动了Apache。我已经在我的虚拟主机在httpd.conf如下:
<VirtualHost *>
DocumentRoot /home/user/appName/public
<Directory /home/user/appName/public>
AllowOverride all
Options -MultiViews
</Directory>
ErrorLog /var/log/httpd/appName_error.log
CustomLog /var/log/httpd/appName_access.log common
</VirtualHost>
但每当我试着去公共IP地址或公共DNS,我只是得到一个超时错误。有谁知道我错了哪里?使用Nginx会更好吗?任何能指引我正确方向的人都将不胜感激!
尝试在此URL中提到的指令:http:/ /albertech.net/2013/04/installing-phusion-passenger-4-0-with-selinux-and-apache-on-rhel-6-3/ – coderhs
对于任何想在未来的亚马逊EC2上设置RoR的人,请看根据社区AMIs。有一个AMI可以为RoR服务器(Nginx,Ruby on Rails,Passenger)设置所需的一切,并自动进行配置。 ID是ami-15e7aa25,它在俄勒冈州的服务器上。我确信还有其他人,但这对我很好。但我的问题仍然存在。 – Kyle