【发布时间】:2015-09-22 06:09:52
【问题描述】:
我无法识别第二个 VirtalHost。几年前我让它工作,但在升级路径的某个地方它坏了。
localhost 被识别。 dev 不是。我在 Windows 7 上使用 XAMPP v3.2.1。在浏览器中输入 dev 会将我发送到浏览器的搜索引擎。 httpd-vhosts.conf 和 hosts 文件设置如下,我已经包含了来自 C:\xampp\apache\bin\httpd -S 的转储。任何帮助将不胜感激。
注意:如果我在dev 目录中输入index.php 文件的显式路径,它不会作为php 文件运行,但只会列出内容。
另外:在我的 access.log 中,我得到以下信息:
127.0.0.1 - - [04/Jul/2015:09:48:12 -0700] "GET /css/ms.js HTTP/1.1" 304 - "http://localhost/dev" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
我的 C:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "D:/Website/root"
ServerName localhost
<Directory "D:/Website/root">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
deny from all
Allow from localhost
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/Website/dev"
ServerName dev
<Directory "D:/Website/dev">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
deny from all
Allow from localhost
Require all granted
</Directory>
</VirtualHost>
我的 c:\windows\system32\drivers\etc
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
127.0.0.1 dev
C:>C:\xampp\apache\bin\httpd -S
VirtualHost configuration: *:80 is a NameVirtualHost
default server localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:44)
port 80 namevhost localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:44)
port 80 namevhost dev (C:/xampp/apache/conf/extra/httpd-vhosts.conf:60)
ServerRoot: "C:/xampp/apache"
Main DocumentRoot: "D:/Website/root"
Main ErrorLog: "C:/xampp/apache/logs/error.log"
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="C:/xampp/apache/logs/" mechanism=default
PidFile: "C:/xampp/apache/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
【问题讨论】: