简体   繁体   中英

Virtual Host config not working in Centos 8 Apache 2.4

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM