【发布时间】:2014-12-17 20:04:00
【问题描述】:
我正在尝试在两个不同的 IP 地址上设置两个不同的域:bbb.zzz.xxx.yyy & bbb.xxx.yyy.zzz 。问题是,domain1 工作正常。当我在浏览器中输入 ip 地址时,第二个站点 (domain2) 正在工作,但当我输入 wwww.domain2.com 时它显示 domain1 的内容。我应该如何解决这个问题?是否缺少任何模块?我在站点可用目录中为不同的域使用不同的文件。
<VirtualHost bbb.zzz.xxx.yyy>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin **********@gmail.com
ServerName domain1.com
ServerAlias www.domain1.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /home/ApacheWebsites/domain1/httpdocs
# Custom log file locations
LogLevel warn
ErrorLog /home/ApacheWebsites/logs/error.log
CustomLog /home/ApacheWebsites/logs/access.log combined
<Directory /home/ApacheWebsites/domain1/httpdocs/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
allow from all
</Directory>
<VirtualHost bbb.xxx.yyy.zzz>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin ************@gmail.com
ServerName domain2.com
ServerAlias www.domain2.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /home/ApacheWebsites/domain2
# Custom log file locations
LogLevel warn
ErrorLog /home/ApacheWebsites/logs/error.log
CustomLog /home/ApacheWebsites/logs/access.log combined
<Directory /home/ApacheWebsites/domain2/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
allow from all
</Directory>
</VirtualHost>
【问题讨论】:
标签: apache ubuntu virtualhost