Apache "Default" showing Virtual Host

Issues related to applications and software problems
Post Reply
Boyd.ako
Posts: 46
Joined: 2016/06/22 08:49:07
Location: Honolulu, HI
Contact:

Apache "Default" showing Virtual Host

Post by Boyd.ako » 2019/06/20 11:26:01

Feel free to send me some Google terms to use because I couldn't quite find what I was looking for.

So, I have a virtual host setup in apache which works fine. But, when I try to go to the ServerName set for the "main/default" in the httpd.conf it displays the virtual host site. I read the welcome.conf file and dropped some index.html/.php files in /var/www/html and commented out the lines in the welcome.conf file and that's when I get the VirtualHost site. Before I did that I would; on occasion, get the welcome.conf web page stuff.

I'm trying to set it up to be name-based virtual hosting.

Virtual Host config

Code: Select all

<VirtualHost *:80>
    DocumentRoot "/var/www/VirtualHostSite"
    ServerName VirtualHostSite.workisboring.com
    ServerAlias www.VirtualHostSite.workisboring.com
    ErrorLog "logs/VirtualHostSite.workisboring.com/error_log"
    CustomLog "logs/VirtualHostSite.workisboring.com/access_log" common
    <Directory /var/www/VirtualHostSite>
    	Options -Indexes
	#<RequireAll>
	#	Require ip 10.0.0.150/24
	#</RequireAll>
    </Directory>
</VirtualHost>
/etc/httpd/conf/httpd.conf

Code: Select all

ServerName Defaultsite.ddns.me:80
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
My noob level: LPIC-2, Sec+ CE, Linux+
https://boydhanaleiako.me

User avatar
remirepo
Posts: 447
Joined: 2014/09/21 09:07:12
Location: France
Contact:

Re: Apache "Default" showing Virtual Host

Post by remirepo » 2019/06/20 15:00:13

The first VirtualHost is the default one (with httpd 2.4). Expected.

You don't have to touch the default httpd.conf

Create
/etc/httpd/conf.d/0-default.conf => default
/etc/httpd/conf.d/1-first.conf => first vhost
etc
Remi's Repository - Forum - Blog

Boyd.ako
Posts: 46
Joined: 2016/06/22 08:49:07
Location: Honolulu, HI
Contact:

Re: Apache "Default" showing Virtual Host

Post by Boyd.ako » 2019/06/20 22:50:20

remirepo wrote:
2019/06/20 15:00:13
Create
/etc/httpd/conf.d/0-default.conf => default
/etc/httpd/conf.d/1-first.conf => first vhost
etc
**scratches head** so the default site would be the first alphanumeric sorted config that would be read in conf.d?
My noob level: LPIC-2, Sec+ CE, Linux+
https://boydhanaleiako.me

User avatar
remirepo
Posts: 447
Joined: 2014/09/21 09:07:12
Location: France
Contact:

Re: Apache "Default" showing Virtual Host

Post by remirepo » 2019/06/21 05:04:39

Yes
Remi's Repository - Forum - Blog

Post Reply