To get Nesta to be served from Apache with Passenger.


About a couple months ago, I came across Nesta which is really awesome and really simple CMS built off the Sinatra framework. But I could not figure out how to host the application with Apache. Fast forward to this evening and I finally found a solution. If you have any suggestions on how it could be done different, please post a comment as I would like to hear about it.


So! you want to build it. Ok, here are the steps I did:

  1. Install RVM and Ruby (I ended up with the single user install as you will notice)
  2. curl -L get.rvm.io bash -s stable
  3. rvm requirements
  4. (install necessary stuff to compile ruby and gems)
  5. rvm install 1.9.2
  6. rvm use –default 1.9.2
  7. Install Nesta
  8. gem install nesta
  9. Create your site home and site itself
  10. mkdir /apps
  11. cd /apps
  12. nesta new mysite
  13. (take note that all additional steps use “/apps/mysite” as the nesta directory)
  14. Install Passenger
  15. gem install passenger
  16. passenger-install-apache2-module
  17. Apache config
  18. mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled /etc/httpd/mods-available /etc/httpd/mods-enabled
  19. Create the file /etc/httpd/mods-available/passenger.conf (see git gist below)
  20. Create the file /etc/httpd/sites-available/mysite (see git gist below)
  21. cd /etc/httpd/sites-enabled
  22. ln -s ../sites-available/mysite mysite
  23. cd /etc/httpd/mods-enabled
  24. ln -s ../mods-available/passenger.conf passenger.conf
  25. turn on NameVirtualHosts feature
  26. sudo /etc/init.d/httpd restart
  27. goto your new site!

Apache configuration example

SetEnv LD_LIBRARY_PATH /home/aaron/.rvm/rubies/ruby-1.9.2-p320/lib
SetEnv GEM_PATH /home/aaron/.rvm/gems/ruby-1.9.2-p320:/home/aaron/.rvm/gems/[email protected]

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

Loaded modules in Apache

LoadModule passenger_module /home/aaron/.rvm/gems/ruby-1.9.2-p320/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
PassengerRoot /home/aaron/.rvm/gems/ruby-1.9.2-p320/gems/passenger-3.0.12
PassengerRuby /home/aaron/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
comments powered by Disqus