문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top