Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    58
    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:
    58
    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:
    58
    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:
    11
    Trophy Points:
    168
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. epanagio

    epanagio Well-Known Member

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

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,936
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    I am happy to hear the solution in that post was able to help you. Thank you for letting us know the issue is resolved.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice