-->

Tuesday, June 5, 2012

Install apache & passenger for rails on amazon linux

First we need to have apache and curl-dev installed  using root..
sudo -s
yum install httpd httpd-devel
yum install libcurl-devel
exit

# now install passenger , if you have problems with gemfiles , fix them first. (check bundle )
gem install passenger
passenger-install-apache2-module

if all goes good you should get instructions like this :
---------------------------------------------------------------
Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-head@smifr/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-head@smifr/gems/passenger-3.0.12
   PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-head@smifr/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!


<VirtualHost *:80>
      ServerName www.yourhost.com
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /somewhere/public  
      <Directory /somewhere/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
      </Directory>
   </VirtualHost>

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

  /usr/local/rvm/gems/ruby-1.9.3-head@smifr/gems/passenger-3.0.12/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/
------------------------------
follow the instractions and update the httpd.conf file , to find it use the command :
apachectl -V

then restart apache using

apachectl -k restart

# After configuring httpd.conf the restart has an error, you need to provide more rights I did:
passenger-config --root
#Returns path_to_root
chcon -R -h -t httpd_sys_content_t /path_to_root


403 error :
You should set permissions for the rails app , so apache can access these files
I am runing:
chmod 755 /home/ec2-user/ -R

If still not working ..
in file: /etc/sysconfig/selinux
change to SELinux=enforced to SELinux=disabled






No comments:

Post a Comment