I Can’t Get Ruby on Rails + Passenger + Apache to Work

apache-2.2phusion-passengerruby-on-rails

I'm sorry if this is a stupid question, but I can't get Ruby on Rails to work on my Apache server. I'm using Phusion Passenger (mod_rails, mod_rack) for app deployment. Here is my RoR-specific configuration code in my website's Apache configuration file:

Alias /rails /var/www/syyborg.com/ruby/blog/public
<Directory /var/www/syyborg.com/ruby/blog/public>
     Options FollowSymLinks
     AllowOverride None
     Order Allow,Deny
     Allow from All
</Directory>
RailsBaseURI /rails

Again, I really have very little knowledge of this kind of thing; I have never set up a server from scratch before. Anyways, my rails app, as you can see, is located at /var/www/syyborg.com/ruby/blog/. I am trying to access it from http://[my domain, syyborg.com]/rails. However, when I try to load the site, I get a "403 Forbidden" error. Any help would be greatly appreciated, and I can provide further details if they are required. Thanks in advance!

Best Answer

If mod_rails is properly installed & loaded, the only configuration you need in apache is to point the document root to the public folder. mod_rails is smart enough to realize where the rest comes from. in apache: the <Directory> statement refers to the physical file location rather than the perceived path. This should also be your public folder for your rails app.

i.e.

<Directory /var/www/syyborg.com/ruby/blog/public>
     Options FollowSymLinks
     AllowOverride None
     Order Allow,Deny
     Allow from All
</Directory>

and your RailsBaseURI should be the path you're looking to use.

i.e.

RailsBaseURI "/rails"

Your alias statement looks fine.