Adding virtual hosts to the Apache configuration

Avatar
  • Answered
CentOS 7, Apache 2.4, Dedicated server I need to add a couple of virtual hosts to the Apache configuration and I'm not sure how to do that in a cPanel/WHM environment. We have a FQDN (sourceware.milesdist.com) pointing to the IP address of the dedicated InMotion server. I would like to set up virtual hosts on port 80 and 443 to point sourceware.milesdist.com to their document root in /home//public_html. I am so used to simply modifying httpd.conf but I understand I cannot do that in a cPanel/WHM setup. Any guidance is appreciated.
Avatar
KyleM
Hello,

Thanks for contacting us about adding a virtual host configuration. If you want the document root to be in an existing account you must add the domain as an addon domain or subdomain to the account you want it to be under. If you do not want the document root to be in an existing account the simplest way to do this would be to login to your WHM as root and go to Service Configuration >> Apache Configuration >> Include Editor. You would want to add it in the pre main or post main include. Any document root defined this way should not be in the home directory to avoid permission issues.

Best Regards,
Kyle M