0

我有以下虚拟主机配置:

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/projects/mycheck.il"
    ServerName mobile.mycheck
    ErrorLog "logs/mobile.mycheck.log"
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/projects/api.il"
    ServerName api.mycheck
    ErrorLog "logs/api.mycheck.log"
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/projects/admin"
    ServerName front.mycheck
    ErrorLog "logs/front.mycheck.log"
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
    ErrorLog "logs/localhost.log"
</VirtualHost>

并使用 Windows,我有以下主机文件

127.0.0.1       localhost
127.0.0.1       mobile.mycheck
127.0.0.1       api.mycheck
127.0.0.1       front.mycheck

但是,无论我尝试在浏览器中放入什么虚拟主机,我总是解析到同一个目录(projects/mycheck.il),知道如何解决这个问题吗?

4

1 回答 1

0

尝试在您的 VirtualHost 声明之前添加以下行:

NameVirtualHost *:80
于 2012-11-15T14:00:20.347 回答