CentOS 5.3 RoR Apache Install
Aug0
I promised this addendum to my previous post CentOS 5.3 RoR Install. Sorry for the wait! Please execute everything in the previous post (from a totally clean install), then continue with these commands:
yum -y install httpd httpd-devel apr apr-devel apr-util apr-util-devel gem install passenger passenger-install-apache2-module
Press enter a few times and you should have all the software installed, so now it’s time to configure Apache:
nano /etc/httpd/conf/httpd.conf
Search for the last LoadModule line (there’s a large block of them), and insert the following after it:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4 PassengerRuby /usr/bin/ruby
Apache can now host Ruby on Rails apps, but you’ll need to create a virtual host directive to link it to an application. I prefer to use small standalone configurations to configure each app separately, here is how:
nano /etc/httpd/conf.d/rails.conf
Replace “rails.conf” with something appropriate (such as “rails_appname.conf”, but make sure it ends with “.conf” so Apache will see it. In this file, paste the following (change to suit) then exit and save:
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /opt/application/public
</VirtualHost>
Be sure to change “yourdomain.com” to the domain you want to listen on, otherwise it will answer all HTTP requests to the server. You can also delete the ServerName line if you want that. I prefer to put applications in my “/opt/” folder, but the above DocumentRoot should point to the “public” folder of your RoR application, wherever it may be.
Almost done! Issue the following command to restart Apache:
service httpd restart
Visit your configured domain (or server) and voila, that’s all there is to it! Certain applications don’t work so well with Passenger, but the majority do. Let me know if you have any trouble with specific ones and I’ll help you through it.
p.s. restarting Apache using the above command will restart your application(s), too.
Enjoy this article?
Consider subscribing to our RSS feed!
No Comments
No comments yet.