Passenger has Stolen by Document Root
Added by Alan Chandler over 12 years ago
I have set up redmine on my Debian based Virtual Server to be served from https://www.hartley-consultants.com/redmine. I have (the same) web site (my core one) as is on http://www.hartley-consultants.com as the root for this server (there are separate Apache virtual hosts, one being the default none SSL one, the SSL one having the same directory and document root as the other).
What seems to have happened is that although Passenger has somehow stolen the document root and is serving up redmine when I access https://www.hartley-consultants.com
This is the setup
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@hartley-consultants.com ServerName www.hartley-consultants.com ServerAlias hartley-consultants.com RewriteEngine On RewriteCond %{HTTP_HOST} !www\.hartley-consultants\.com [NC] RewriteRule ^(.*)$ https://www.hartley-consultants\.com$1 [R=301,L] RewriteCond %{HTTPS} !=on RewriteRule ^/redmine/.* - [F] RewriteCond /var/www/redmine/tmp/stop.txt -f RewriteCond /var/www/redmine/%{REQUEST_FILENAME} !-f RewriteRule ^/redmine/(.*)$ /redmine/$1 [R=503,L] DocumentRoot /var/www/hartley <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/hartley> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all DirectoryIndex /index.php </Directory> RailsBaseURI /redmine PassengerAppRoot /var/www/redmine <Directory /var/www/hartley/redmine> AllowOverride None Options -MultiViews Order allow,deny allow from all </Directory> ... (sets up SSL certificates etc)
The directory that is now called /var/www/hartley/redmine is symlinked to point to /var/www/redmine/public, where I have pointed Passenger's root to.
Where am I going wrong?
Replies (1)
RE: Passenger has Stolen by Document Root - Added by Alan Chandler over 12 years ago
Alan Chandler wrote:
I have set up redmine on my Debian based Virtual Server to be served from https://www.hartley-consultants.com/redmine. I have (the same) web site (my core one) as is on http://www.hartley-consultants.com as the root for this server (there are separate Apache virtual hosts, one being the default none SSL one, the SSL one having the same directory and document root as the other).
What seems to have happened is that although Passenger has somehow stolen the document root and is serving up redmine when I access https://www.hartley-consultants.com
This is the setup
[...]
RailsBaseURI /redmine PassengerAppRoot /var/www/redmine <Directory /var/www/hartley/redmine> AllowOverride None Options -MultiViews Order allow,deny allow from all </Directory>
The directory that is now called /var/www/hartley/redmine is symlinked to point to /var/www/redmine/public, where I have pointed Passenger's root to.
Where am I going wrong?
I've solved this - I just wish the way to do SubURIs was explained a bit clearer, both here and on the phusion web site
In the above snippet, I put the PassengerAppRoot /var/www/redmine
directive in a location block
<Location /redmine> PassengerAppRoot </Location>
It is important to understand why. What I think is happening is that when fusion is passing the block to see if its to run an application at this point (ie at Document Root) it sees that and then using PassengerAppRoot to look for PassengerAppRoot/config/environment.rb
which it finds. I therefore thinks that /var/www/hartley is a rails application to serve. By putting it is the Location block it only finds the directive if the URL has the /redmine in it.