Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

virtualhost - Apache2 virtual host strange behaviour

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 [email protected]
    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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...