我正在尝试在两个不同的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>
答案 0 :(得分:0)
你的第一个片段说
ServerName domain1.com
ServerAlias www.domain2.com
将服务器别名更改为www.domain1.com,它应该可以正常工作。