简体   繁体   中英

Install Ruby on Rails with Passenger on Centos 6.5 Amazon EC2

I'm pretty new to Ruby on Rails, and completely new to Amazon EC2. I was able to setup RoR, Passenger, and Apache on Linode with CentOS 6.5 using the directions found here: https://www.rosehosting.com/blog/install-ruby-on-rails-with-apache-and-passenger-on-centos-6/

Everything worked fine, I was able to get it up and running with no problem. But my client uses Amazon EC2, so I have to set it up on their server. When trying it on Amazon EC2, once I get to the rvmsudo passenger-install-apache2-module part, I get the following error:

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

I followed the steps at the URL provided, but it still gives me the same error. I disabled SELinux, and then running the above command again I get an error saying that there is not enough swap space. I run the following commands, as it says to:

sudo dd if=/dev/zero of=/swap bs=1M count=1024
sudo mkswap /swap
sudo swapon /swap

After running that, I'm able to run rvmsudo passenger-install-apache2-module , and it installs successfully. I added the lines to httpd.conf as it said, and restarted Apache. I have the following for my Virtual Host in 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>

But whenever I try to go to the Public IP address or the Public DNS, I just get a timeout error. Does anyone have any idea where I went wrong? Would using Nginx be better? Anyone who can point me in the right direction would be greatly appreciated!

Passenger author here.

There is something I don't understand. You mentioned that you followed the steps in the RPM installation instructions, but later you mentioned creating a swap file. Our RPM installation process should never ask you to create a swap file. Nor should the RPM installation process involve passenger-install-apache2-module. So what exactly did you do as part of the RPM installation process? Can you tell me the exact steps that you took after reading the message mentioning RPMs?

But if your server doesn't have anything important on it right now, then I recommend that you start over from scratch, using a completely new and empty server, and follow the official Passenger deployment walkthrough . This walkthrough is new (written a month ago) and is completely end-to-end. It teaches you how to launch a server, how to install Ruby, how to install Passenger in a way that best suits your operating system, how to deploy an app, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM