我正在尝试配置我的虚拟主机。我想要的行为如下:当我输入“http://www.mydomain.com”时,我会显示“mydomain”页面。当我输入IP“http://WW.XX.YY.ZZ”时,我在“/ var / www”中显示默认页面。
目前,无论我在地址栏中输入什么,我都会显示“mydomain”页面。
这是我的配置文件:
apache2.conf:
<VirtualHost _default_:*>
DocumentRoot /var/www
</VirtualHost>
# Include the virtual host configurations:
Include sites-enabled/
/ webmin.xxx.conf启用位点-
<VirtualHost mydomain.com:80>
ServerName mydomain.com
DocumentRoot "/home/mydomain/www"
<Directory "/home/mydomain/www">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
顺便说一下,每次重启apache时,我都会遇到这些错误:
* Restarting web server
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Fri Apr 12 13:14:51 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Fri Apr 12 13:14:52 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
答案 0 :(得分:0)
你/ etc / hosts中的一个条目:
YOUR_IP mydomain.com
它将帮助apache找到正确的IP地址。