0

我正在尝试配置我的虚拟主机。我想要的行为如下:当我输入“ 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
4

1 回答 1

0

在 /etc/hosts 中有一个条目:

YOUR_IP mydomain.com

它将帮助 apache 找到正确的 IP 地址。

于 2013-04-12T10:14:56.357 回答