Support / KnowledgeBase

 
Search the KnowledgeBase Search

Changing your default html (httpdocs) directory

  • Applies to: All (dv)

  • Difficulty: Medium

  • Time needed: 15 minutes

  • Tools needed: None

 

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.


This article has the following dependencies:


  • If you currently do not have your root user enabled please visit the Root Access & Developer Tools section of your AccountCenter.
  • mt-example.com is used as an example. Please be sure to replace this text with the proper information for your site or server.

  • 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 -av
    6. Restart the Apache webserver gracefully:
     /etc/init.d/httpd graceful
    7. 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

    User Comments

    No visitor comments posted. Post a comment

    Fields marked with an asterisk(*) are required. Comment on this article

    Fill out the form below if you would like to comment on this article.
     
     
     

    (code is not case-sensitive)
     
    Submit
     
     

    Continue