Same DocumentRoot, Different Environment for each vhost not possible?

3 views
Skip to first unread message

Steffen

unread,
Oct 20, 2008, 4:24:57 PM10/20/08
to Phusion Passenger Discussions
Hi,

I'm having two vhosts with the same DocumentRoot but with two
different RailsEnv settings which isn't working for me as expected.

My vhosts confs look like:
<VirtualHost *:80>
ServerName app-development
DocumentRoot "/app/public"
RailsEnv development
</VirtualHost>

<VirtualHost *:80>
ServerName app-production
DocumentRoot "/app/public"
RailsEnv production
</VirtualHost>

The Problem:
If I restart apache and open app-development in my browser, the app is
loaded with the development env, which is what I expect. But if I open
app-production next, the app is also loaded with the development env.
It's the same the other way around. That means that it looks like that
the first env that get's spawned will be the one for all vhosts with
the same DocumentRoot.
(Btw, I'm not using dev and prod env, but two custom staging envs)

So the question basically is, if I have to use different DocumentRoots
or if there are any other tricks?

Thanks for any advice!
Steffen

P.S. I checked the forum and user guide, with no luck though.

gw

unread,
Oct 21, 2008, 11:45:29 AM10/21/08
to Phusion Passenger Discussions
> I'm having two vhosts with the same DocumentRoot but with two
> different RailsEnv settings which isn't working for me as expected.
>
> The Problem:
> If I restart apache and open app-development in my browser, the app is
> loaded with the development env, which is what I expect. But if I open
> app-production next, the app is also loaded with the development env.
> It's the same the other way around. That means that it looks like that
> the first env that get's spawned will be the one for all vhosts with
> the same DocumentRoot.
> (Btw, I'm not using dev and prod env, but two custom staging envs)
>
> So the question basically is, if I have to use different DocumentRoots
> or if there are any other tricks?

One theory -- if something is written to the /tmp directory in the
Rails application that Passenger uses to determin env, that would
result in comman info being used by multiple vhosts. If that's the
case, two copies of the application will certainly be necessary (kinda
sounds like it is anyway).

-- gw

Steffen

unread,
Oct 23, 2008, 11:21:23 AM10/23/08
to Phusion Passenger Discussions
Hi gw,

thanks for your answer.
As far as I can tell passenger doesn't put anything in the tmp
directory.

I just had the idea to create a symbolic link with a different name
but linked to the same folder.
Unfortunately passenger finds out that the documentroot is a symbolic
link and therefore spawns the original folder which leads to the same
problem as described above.

Hmm, it's a pity that this just doesn't work. Nothing critical but
would make passenger in your dev environment so much cooler.

Regards,
Steffen
Reply all
Reply to author
Forward
0 new messages