The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Configuring a virtual host

Discussion in 'EasyApache' started by epanagio, Sep 7, 2013.

  1. epanagio

    epanagio Well-Known Member

    Joined:
    May 26, 2012
    Messages:
    50
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Website Owner
    Shiver me timbers!

    I would like to have a special documentroot for just one domain and I am wondering if I am going about it correctly.

    In /usr/local/apache/conf/extra/ I found this interesting file, httpd-vhosts.conf.

    I am hosting several domains. All except one will have the default documentroot.

    Is this all I need to have?

    If my domain name is domain.com with the document root in /home/evan/public_html/wordpress would the httpd-vhosts.conf look like this?

    How would I let apache know that I am using virtual hosts?


    Also, if something goes wrong and I want to disable virtual hosting because the httpd-vhosts.conf is incorrect how would I let apache know to ignore the erroneous httpd-vhosts.conf file?

    Thanks!
     
    #1 epanagio, Sep 7, 2013
    Last edited: Sep 7, 2013
  2. epanagio

    epanagio Well-Known Member

    Joined:
    May 26, 2012
    Messages:
    50
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Website Owner
    I looked in httpd.conf and there is a virtual host included for every domain. If I were to include a httpd-vhosts.conf that would override the cpanel's entry I am guessing that I would include it AFTER the cpanel's generated entry in httpd.conf?
     
  3. epanagio

    epanagio Well-Known Member

    Joined:
    May 26, 2012
    Messages:
    50
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Website Owner
    After adding a virtual host the documentroot is not served properly.

    httpd restarts without errors.

    NameVirtualHost *:80
    <VirtualHost *:80>
    ServerAdmin <email here>
    DocumentRoot "/home/<account>/public_html/wordpress"
    ServerName <domain name>
    ServerAlias www.<domain name>
    ErrorLog "/usr/local/apache/logs/a-name_log"
    CustomLog "/usr/local/apache/logs/a-name-access_log" common
    </VirtualHost>

    When I go to domain name it does not shows me the contents of the documentroot path, instead, I get the contents of the domain name, which is a list of directories.
     
  4. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
  5. epanagio

    epanagio Well-Known Member

    Joined:
    May 26, 2012
    Messages:
    50
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Website Owner
    Thanks, quietFinn. Fixed!
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page