Problem running Rails/Passenger app on slice that also serves static html sites
I'm running a Rails app on an ubuntu hardy box with passenger. I also have a couple basic html sites running on the same box. My problem is that the apache vhost set up for the html sites seems to be blocking my Rails app from resolving at the proper url.
I have a number of Rails apps running on different slices usin开发者_开发问答g passenger, so I know how to make this work generally.
I'm not getting any errors in the terminal or in the apache logs. Everything appears to be working perfectly, but the site will simply not resolve at the proper url. Instead, when I go to the url where my Rails app should be, I see the site that is the apache default vhost on my slice.
To confirm my assumption, I disabled all of the vhosts on my slice associated with the static html pages. After doing that, my Rails app appeared at the proper url and worked fine. When I re-enabled the vhosts for the html sites, I was back to the same problem again.
My bet is that there's an easy configuration fix to this, but I can't figure it out. Anybody know?
Thanks.
Update to answer question in the comment
Yes, the static sites work fine by themselves. Under all circumstances, the static sites are fine.
My vhost files are using super basic setup. Static site vhost files look like this:
<VirtualHost *:80>
ServerName foo.com
ServerAlias www.foo.com
DirectoryIndex index.html
DocumentRoot /home/blah/public_html/foo/public
</VirtualHost>
Passenger vhost file looks like this:
<VirtualHost *:80>
ServerName bar.com
ServerAlias www.bar.com
DocumentRoot /home/blah/public_html/bar/current/public
</VirtualHost>
If you want to verify your apache virtual host configuration try doing:
apache2 -S
or
apache2 -t -D DUMP_VHOSTS
both should dump your vhosts list. Maybe your rails virtual host gets assigned to some other IP?
Did you have -MultiViews option turn on/off?
<VirtualHost *:80>
ServerName www.phusion.nl
DocumentRoot /websites/phusion
<Directory /websites/phusion>
Allow from all
</Directory>
RailsBaseURI /rails # <-- These lines have
<Directory /websites/phusion/rails> # <-- been added.
Options -MultiViews
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements
精彩评论