• 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

      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

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.

  • @user477030 : Should have also stated that I already did this before I started debugging my changes to httpd.conf. I'll go ahead and update the post now to reflect this. – AgentJ Jul 7 '18 at 21:21

Something like this should work - be sure that the filename ends in .conf. I host quite a few domains for me and my friends, so the DocumentRoot for each is /var/www-domain. I name the file /etc/apache2/sites-available/domain.conf and then link it over or use a2ensite and then restart/reload apache. Be sure to make the /var/www-example.com directory! Finally, apache2ctl -S will show/test your config

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www-example.com
    <directory /var/www-example.com>
        Options All
                AllowOverride All
                Require all granted
  • Thank you very much. Your solution seems to get Apache running again. However, trying your solution straight out makes both domains give me the "Testing" page rather than the content I have in. I'll try to play around with it. One disclosure, I don't seem to have a2ensite installed nor is it in Red Hat's default repositories. Is it a private script? – AgentJ Jul 8 '18 at 13:43
  • @AgentJ no, part of apache for me on my Debian systems. The sites-available and sites-enabled config style is rather debian-ish as well - but it has been a few years since I played with a redhat/fedora/centos system. All a2ensite does is make the symlink from sites-available to sites-enabled and prompt you to reload the apache config – ivanivan Jul 8 '18 at 13:46
  • Ok. Cool. Yeah, I take it the fact that the "Testing" page isn't coming up means something's not routing to where I want it to go. There's a few things I can think of trying, but I best do some more reading first. I know next to nothing about site admin stuff, and would like to read up before I post again in an "I don't know what's wrong kind of style". :) Thank you for your help. – AgentJ Jul 8 '18 at 13:49

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.