Metal Toad has been building applications and cloud environments for some of the most well-known global brands for over a decade. Learn more > >

Avoid Potholes When Deploying Drupal Sites to Media Temple Virtual Private Servers

I recently had occasion to set up a new Drupal site on a dedicated virtual private server on Media Temple (dv 4.0). Everything was going swimmingly until I deployed the site and tried to reach it via the IP address.

The result was the install.php page, even though my settings file was uploaded and had the correct settings for the database.

To make matters more frustrating, the log files were not located in the standard place (/var/log/httpd/domain.com-error.log)

After some searching we* finally found them at /var/www/vhosts/domain.com/conf/ and found that the particular file that contained the database settings was causing a 403 error - access forbidden.

More searching revealed a setting in the httpd config file that automatically sets the open_basedir option for Apache like so:

php_admin_value open_basedir /var/www/vhosts/yourdomain.com/httpdocs/:/tmp/

Which meant that anything outside of the approved directories - like say, the settings file which stores the database information - couldn't be reached.

So then it was off to the httpd_ip_default.include file in the conf folder.

The first lines in that file were extremely ominous:

A stern warning not to edit this file

# 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/penusa.org/conf/vhost.conf
#/var/www/vhosts/penusa.org/conf/vhost_ssl.conf

Backing away slowly, we created the vhost.conf file and set open_basedir to none to turn off the option, restarted Apache and waited for magic.

Nothing.

Don't tell anyone, but at that point, we edited the DO NOT EDIT file, just to see if it would actually fix things. It did, yay! But we did it illegally, boo!

Later when I had more time, I dug a little deeper to figure out the right way to override the conf file.

In this Media Temple knowledge article, I found the magic ingredient:

Reconfigure your webserver so it will look for your new vhost.conf file by running the following code:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain example.com

REALLY? That would have been nice information to put in the DO NOT EDIT message don't you think?

So now the vhost.conf file looks like this:

<Directory "/var/www/vhosts/yourdomain.com/httpdocs">
  php_admin_value open_basedir none
  Options +FollowSymLinks
</Directory>

And voila! After restarting Apache, Our files were all visible again and life (well, at least surfing), could resume.

I hope this little story can save a few other Media Temple users a few headaches.

*Thanks to Dylan Tack for much help in solving these deployment issues.

Comments

I wanted to apologize for the inconvenience you guys experienced. We try to put out a great user experience, along with great knowledge articles, to make our customer's lives easier. I'm going to speak with our team to see if there is anything we can do to change that message or make things clearer in any other way. We want all of our users to have the best experience possible, but we know that things fall through the cracks at times. Hope all is going well, and feel free to give us a call, tweet, or support request if you have any questions, suggestions, or problems.

Hey that's a quick response!

Great to see you guys are paying attention. On the bright side, I found that article because of the auto-search that is in place in the contact form, which I found to be a very smart UX choice.

Perfect. I don't think we'll be able to change the Plesk " DO NOT EDIT " portion, but hopefully we'll come up with something that may tackle this problem in another way. Thanks again for the feedback.

I have to admit I am a long time (and mostly satisfied) MT DV user. I just ran into exactly this same issue the other day and spent quite a bit of time cursing before I found that magic reconfigure bit. THen I spent more time cursing since I am on DV 3.5 and it does not seem to work. Still trying though, thanks for posting the vhost.conf snippet, I think that may be where my problem lies.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Ready to get started?