Ruby on Rails with Apche

Web Server for Rails

In Rails, we can use WEBrick for development use.
This is basically development use.
If we can use Apache, we can use Apache features and take better performance.


I tried following environments

  • Ubuntu 15.10
  • Rail 4.2.3
  • Ruby 2.3.0
  • passenger

passenger : Phusionpassenger

I created rbenv environment for it. Please see other entry. rbenv

Install rails and passeneger

gem install rails
gem install passenger

We need some dependencies to install rails, please follow your result to run these commands

Start passenger and clear dependencies


Install all dependencies for passenger, if you have error, please follow
The final results show apache configuration for Ruby. Please memo and add them to

LoadModule passenger_module /home.....
  <IfModule mod_passenger.c>

/home … is your directory.
That’s all for Apache module settings. Next is rails

Create vhost

Please take a look other entry Apache Ubuntu vhost

Copy rails project under vhost

To run with PRODUCTION environment, please be careful two things

  • Need secret key for production with config/secret.yml
  • root routes

We need root routing in config/routes.rb, for development index.html was created by default, but not for production
If you want to check run, use WEBrick and it works or not

rails server -e production

After test, and stop WEBrick.
O.K. That’s all for setting. Restart


Please restart Apache

sudo service apache2 restart