I'm tryng to set up multiple apache virtual host on my machine.
My configuration actually works but I have some strange issues.
First of all I edit my hosts file like this.
127.0.0.1 localhost
127.0.1.1 kali
127.0.0.1 www.dom1.com
127.0.0.1 www.dom2.com
127.0.0.1 www.dom3.com
127.0.0.1 www.dom5.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
I'm expecting that if I enter any domain in the list I will be connected to the properly server hosted page.
<VirtualHost *:80>
ServerAdmin admin@mypersonaldomain2.com
ServerName dom1.com
ServerAlias www.dom1.com
DocumentRoot /var/www/dom1/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
This is the model of configuration for every virtual host
Every host has an index.html file in the proper directory.
Now the virtual host at www.dom1.com is only accessible from the "localhost" domain and not from www.dom1.com. The domain at www.dom3.com send me to a internet page, while I'm expecting that this domain will be resolved locally before DNS resolution. The other virtual hosts www.dom2.com and www.dom5.com are behaving as expected.
Did i made some misconfiguration in order to get this strange behaviour??
question from:
https://stackoverflow.com/questions/66060937/apache2-virtual-host-strange-behaviour 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…