【发布时间】:2015-09-28 15:54:55
【问题描述】:
我对 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/
一切正常,我能够毫无问题地启动并运行它。但是我的客户使用 Amazon 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 会更好吗?任何能指出我正确方向的人将不胜感激!
【问题讨论】:
-
试试这个网址中提到的指令:albertech.net/2013/04/…
-
对于希望将来在 Amazon EC2 上设置 RoR 的任何人,请查看社区 AMI。有一个 AMI 可以设置您为 RoR 服务器(Nginx、Ruby on Rails、Passenger)所需的一切并自动配置它。 ID 是 ami-15e7aa25,位于俄勒冈服务器上。我敢肯定还有其他人,但这对我很有用。我的问题仍然存在。
标签: ruby-on-rails ruby apache amazon-ec2 passenger