skip to Main Content

I have never faced this issue before , but on this fresh install of CentOS 8 and apache 2.4 , I am trying to add new virtual host in vhost.conf file in the /etc/httpd/conf.d/, as below

<VirtualHost *:80>
ServerName db.example.com
ServerAlias db.example.com
DocumentRoot /usr/share/mysite

<Directory /usr/share/mysite>
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>

</VirtualHost>

I tested config
#apachectl configtest

Syntax OK

But still when this is present in conf.d , server throws HTTP 500 error. When I remove this file and restart server , welcome page is shown.

I am totally lost here , please help

2

Answers


  1. Chosen as BEST ANSWER

    This was sad but I had to move back to CentOS 7 due to to time constraint. Used same configurations there and it worked with a charm.

    In centos 8, it was reading the configurations, as I had spell mistake in path in the .conf file for which apache threw the error (file not found) . But moment it was corrected it again threw error 500.

    Then I had to revert to centos 7 and all worked , I saved lot of time.


  2. Add virtual host on /sites-available, create a site.conf inside then do a2ensite site.conf

    follow this tutorial for exact steps

    https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search