Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
446 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 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

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

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...