Question

I have a mediatemple (dv) account and when i setup a rails app, i normally create a file in /var/www/vhosts/mysite.com/conf/vhost.conf and put the following contents in it:

ServerName mysite.com
ServerAlias mysite.com
DocumentRoot /var/www/vhosts/mysite.com/current/public
PassengerAppRoot /var/www/vhosts/mysite.com/current

<Directory "/var/www/vhosts/mysite.com/current/public">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
</Directory>

RailsEnv production
RailsBaseURI /
PassengerMaxPoolSize 1
PassengerMaxInstancesPerApp 1
PassengerPoolIdleTime 30

Then i use capistrano to deploy my app.

I'm now faced with the circumstance where i want to have a site at mysite.com, but also a test site at staging.mysite.com.

The test site will reside in /var/www/vhosts/mysite.com/staging

How do i configure my vhost.conf file to handle 2 separate rails apps?

Was it helpful?

Solution

Ok i figured this out so i'll share it with everyone.

You need to create a subdomain in plesk by going to the control panel for your domain, click the domains link and then at the bottom you can add a new subdomain.

Creating a subdomain in plesk creates these folders

/var/www/vhosts/mysite.com/subdomains
/var/www/vhosts/mysite.com/<mysubdomain>

I just put my rails app files in /var/www/vhosts/mysite.com/<mysubdomain> and then in /var/www/vhosts/mysite.com/subdomains/<mysubdomain>/conf i just create another vhost.conf file for my subdomain.

After that stuff is setup, then I ran /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain <mydomain> and /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain <subdomain.mydomain>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top