Fixing Subdomain Configuration on Mediatemple DV

I recently found myself having to make some php configuration changes which are specific to a particular subdomain on my Mediatemple DV web host, and found that yet another part of subdomain setup is mildly broken out-of-the-box. This is the sort of thing that most people who need it can probably figure out for themselves, but I'm posting the solution hoping someone will find it useful.

On my DV the domain specific apache configuration is located in /var/www/vhosts/domain-name/conf/, where domain-name is of course replaced by your actual domain name. In this directory you should find at least httpd.include, and possibly vhost.conf as well. If you open httpd.include you'll find the following alarming warning at the top:

# ATTENTION!
# DO NOT MODIFY THIS FILE OR ANY PART OF IT. THIS CAN RESULT IN IMPROPER PLESK
# FUNCTIONING OR FAILURE, CAUSE DAMAGE AND LOSS OF DATA. IF YOU REQUIRE CUSTOM
# MODIFICATIONS TO BE APPLIED TO THE CONFIGURATION, PLEASE, PERFORM THEM IN THE
# FOLLOWING FILE(S):
# /var/www/vhosts/domain-name/conf/vhost.conf
# /var/www/vhosts/domain-name/conf/vhost_ssl.conf
# /var/www/vhosts/domain-name/subdomains/subdomain-name/conf/vhost.conf

Well enough. But it's broken out of the box: httpd.include won't tell apache to look for the /var/www/vhosts//subdomains/subdomain-name/conf/vhost.conf, so any configuration you put into that file won't be applied when you restart apache. So we have to disregard the warning and edit /var/www/vhosts/domain-name/conf/httpd.include anyway. Make sure that the VirtualHost section for the particular subdomain contains a line like this:

Include /var/www/vhosts/domain-name/subdomains/subdomain-name/conf/vhost.conf

In my case I had to add that Include line; I inserted it just before the end of the relevant VirtualHost section. Remember to replace domain-name with your actual domain name, and subdomain-name with the subdomain you're configuring for. Then just restart apache and whatever directives you have in vhost.conf should apply. Good luck!

Two Comments So Far

*
January 27, 2011
John says:
I think I am trying to achieve similar goals in that I want to create wild card subdomains and have those subdomains redirect to either directories or as variables so I can use a PHP $_GET function to process accordingly.

I have tried modifying the htaccess files but it seems Media Temple has some strange configuration that tries to redirect every subdomain to the subdomain directory and as such never works with my configuration.

Have you had any luck with such?
*
February 04, 2011
Eiki Martinson says:
You're going to have to step on plesk's toes quite a lot to do wildcard subdomains, I imagine. I've never done it myself. In truth, I'm moving this site off of the current plesk DV onto a new Mediatemple DV running bare CentOS, plesk-free, at least partly to avoid problems like this; the deeper I got into server configuration, the more Plesk became a hindrance rather than a help.

If you haven't gotten anywhere with this problem as yet, start by digging into /etc/httpd/conf.d, there should be a file there named zz010_psa_httpd.conf that may get you closer to the solution.

Add a Comment

Archives: