Question

Why does a vhost listen directly to an IP?

When requesting an IP address http://xxx.xxx.xxx.xxx apache returns a webpage meant to be returned when requesting the domain? This will result in duplicate content

Have multiple servers and only this one returns a default vhost when requesting the IP

This is how the vhost looks like

<VirtualHost *:80>
    ServerName domain.com
    DocumentRoot /var/www/public
</VirtualHost>

Does anyone have suggestions on how to solve it/where the misconfiguration is located?

If all vhosts is deleted, then http://xxx.xxx.xxx.xxx returns 404

Was it helpful?

Solution

you can put another virtual host before the one with the domain you want. The first virtual host will be the default one and will be served up if there is not a closer match. So if you request by the ip then it will match the default one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top