Changing your default html (httpdocs) directory
By default your (dv) Dedicated-Virtual Servers serves all your web content from the path /var/www/vhosts/mt-example.com/httpdocs/. Using a vhost.conf file you can override this with a different location.
vhost.conf files allow you to override the Apache webserver defaults at the domain level on your server. There are many settings that can be configured this way. This article will focus on just changing your DocumentRoot.
Before proceeding make sure you have read the following KnowledgeBase Articles:
1. Login to your (dv) Dedicated-Virtual Server as root and change to the following directory:
cd /var/www/vhosts/mt-example.com/conf 2. Create a new file using vi named vhost.conf:
vi vhost.conf
3. Paste the following content into this file:
<Directory /var/www/vhosts/mt-example.com/httpdocs>
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value open_basedir "/var/www/vhosts/mt-example.com/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value open_basedir "/var/www/vhosts/mt-example.com/httpdocs:/tmp"
</IfModule>
Options -Includes -ExecCGI
</Directory>
4. Add another line right after the closing </Directory> line with the new path you would like for your html directory using the DocumentRoot directive. For this article we will use a sub-directory named temp:
DocumentRoot /var/www/vhosts/mt-example.com/httpdocs/temp
5. Save your file and use the websrvmng command to reload your new settings making sure they work:
/usr/local/psa/admin/sbin/websrvmng -av6. Restart the Apache webserver gracefully:
/etc/init.d/httpd graceful7. Verify that your website is loading properly after making sure you have an index file in your temp directory.
Notes/Supplemental Resources:
You might also want to read the following KnowledgeBase Articles for additional methods:
Revisions:
2009-01-23: Article Creation
Fields marked with an asterisk(*) are required. Comment on this article