Issue with httpd configuration in Apache for Virtual Hosts

AgentJ asked:

SHORT VERSION

  • Trying to use virtual hosting on an old computer to serve web content on my home network over different domains linked to the same ip address by following a tutorial.

  • After following the tutorial, I get the error:

    $sudo service httpd restart
    $Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details
    
  • After reviewing systemctl and journalctl’s output as directed, forum reading and going through stuff, find that commenting out the following line in /etc/httpd/conf/httpd.conf allows me to start httpd:

    IncludeOptional sites-enabled/*.conf
    
  • I believe something is wrong with the directory that is symbolically linked to sites-enabled, but can’t figure out what against the tutorial. All information is posted below.

Necessary Information

  • Link to tutorial I’m following

  • Version of Apache: 2.4.6

  • Files in /etc/httpd/sites-available (sites-enabled symlinked to this dir)

    • example2.com.conf
    • example.com.conf
  • example.com.conf contents

    <VirtualHost 192.168.1.4:80>
      ServerName www.example.com
      ServerAlias example.com
      DocumentRoot /var/www/example.com/public_html
      ErrorLog /var/www/example.com/error.log
      CustomLog /var/www/example.com/requests.log combined
    </VirtualHost>
    

The contents of example2.com.conf are the same except with “example2” replacing every instant of “example”

Please let me know of any other files or output needed to help troubleshoot this.

My answer:


This is happening because you have an error in one of your configuration files. Run apachectl -t to find it.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.