Php Apache:两台主机指向相同的域

Php Apache:两台主机指向相同的域,php,apache,virtualhost,Php,Apache,Virtualhost,我在同一台服务器上有两个网站,分别位于两个单独的文档根目录下。现在,这两个站点的URL都在域级别进行了更改(这是由第三方完成的)。现在,问题是两个URL都链接到同一个网站。问题出在哪里 虚拟主机就是这么说的: NameVirtualHost 123.123.123.124:80 <VirtualHost 123.123.123.124:80> ServerName www.test.com DocumentRoot "/path/to/document/r

我在同一台服务器上有两个网站,分别位于两个单独的文档根目录下。现在,这两个站点的URL都在域级别进行了更改(这是由第三方完成的)。现在,问题是两个URL都链接到同一个网站。问题出在哪里

虚拟主机就是这么说的:

NameVirtualHost 123.123.123.124:80
<VirtualHost 123.123.123.124:80>  
    ServerName www.test.com
        DocumentRoot "/path/to/document/root/"
      <Directory "/path/to/document/root/">
      php_admin_flag engine on
      Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all
DirectoryIndex index.html index.php
    </Directory>
</VirtualHost>

NameVirtualHost 123.123.123.124:80
<VirtualHost 1123.123.123.124:80>  
    ServerName www.test2.com
    DocumentRoot "/path/to/document/root/"
      <Directory "/path/to/document/root/">
        php_admin_flag engine on
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
NameVirtualHost 123.123.123.124:80
服务器名www.test.com
DocumentRoot“/path/to/document/root/”
php_admin_标志引擎打开
选项索引跟随符号链接多视图
AllowOverride AuthConfig
命令允许,拒绝
通融
DirectoryIndex.html index.php
NameVirtualHost 123.123.123.124:80
服务器名www.test2.com
DocumentRoot“/path/to/document/root/”
php_admin_标志引擎打开
选项索引跟随符号链接多视图
不允许超限
命令允许,拒绝
通融
DirectoryIndex.html index.php

我不知道问题的原因。但是,如果为虚拟主机设置此配置,会发生什么情况:

# try it with the asterisks in front of :80
# are you shure 123.123.123.124 is the ip you need?
NameVirtualHost *:80

# setup for test.com
<VirtualHost *:80>
    ServerName www.test.com
    DocumentRoot /path/to/document/test/
</VirtualHost>

<Directory "/path/to/document/test/">
    php_admin_flag engine on
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    DirectoryIndex index.html index.php
</Directory>

# setup for test2.com
<VirtualHost *:80>
    ServerName www.test2.com
    DocumentRoot /path/to/document/test2/
</VirtualHost>

<Directory "/path/to/document/test2/">
    php_admin_flag engine on
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    DirectoryIndex index.html index.php
</Directory>

你能发布你的设置代码吗?你使用的是两个不同的虚拟主机在不同的端口上监听吗?@JoelStüdle虚拟主机配置添加到post中。谢谢
# macintosh
sudo apachectl restart

# linux
sudo service apache2 restart

# windows
# sorry i do not know :D