apache vhost设置不起作用
第一件事。。我对apache配置还很陌生 我正在尝试在本地为apache配置vhost (根据phpinfo(),Apache/2.4.10(Win32)OpenSSL/1.0.1i PHP/5.6.3) 通过XAMPP(XAMPP-win32-5.6.3-0)进行设置。 操作系统是Windows7家庭高级版SP1 因此,我已经阅读了一些关于设置vhost的文章(本论坛中也有一些)。 我的主机文件如下所示:apache vhost设置不起作用,apache,xampp,vhosts,Apache,Xampp,Vhosts,第一件事。。我对apache配置还很陌生 我正在尝试在本地为apache配置vhost (根据phpinfo(),Apache/2.4.10(Win32)OpenSSL/1.0.1i PHP/5.6.3) 通过XAMPP(XAMPP-win32-5.6.3-0)进行设置。 操作系统是Windows7家庭高级版SP1 因此,我已经阅读了一些关于设置vhost的文章(本论坛中也有一些)。 我的主机文件如下所示: # Copyright (c) 1993-2009 Microsoft Corp. #
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 test.local
我的C:\xampp56\apache\conf\extra\httpd-vhosts.conf包含以下代码:
<VirtualHost *:80>
ServerName test.local
ServerAlias test.local
DocumentRoot "C:/xampp56/htdocs/test.local"
DirectoryIndex app.php
</VirtualHost>
模块mod_log_config.so也加载在httpd.conf中
LoadModule log_config_module modules/mod_log_config.so
(在对配置文件进行所有编辑之后,我保存了它们并重新启动了apache。)
当我在FireFox中键入test.local(或)时,它总是说“找不到test.local”。然而,当我调用localhost时,它就工作了
我还没有找到任何答案,只是想检查vhost和主机文件是否设置正确(在我看来就是这样)
抱歉发了这么长的帖子,如果这只是我在这里犯的一些愚蠢的错误,我也很抱歉
谢谢你的帮助
编辑:
以下是httpd-S命令的输出:
VirtualHost configuration:
*:80 test.local (C:/xampp56/apache/conf/extra/httpd-vhosts.conf:44)
*:443 www.example.com (C:/xampp56/apache/conf/extra/httpd-ssl.conf:80)
ServerRoot: "C:/xampp56/apache"
Main DocumentRoot: "C:/xampp56/htdocs"
Main ErrorLog: "C:/xampp56/apache/logs/error.log"
Mutex ssl-cache: using_defaults
Mutex default: dir="C:/xampp56/apache/logs/" mechanism=default
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
PidFile: "C:/xampp56/apache/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
我找到了解决办法。
是Avira阻止访问我的主机文件。。在avira中禁用该选项,vHost现在可以正常工作
除此之外,我还需要管理员权限,而这些权限没有为我使用的帐户设置。看起来Firefox无法解析
test.local
hostname。
VirtualHost configuration:
*:80 test.local (C:/xampp56/apache/conf/extra/httpd-vhosts.conf:44)
*:443 www.example.com (C:/xampp56/apache/conf/extra/httpd-ssl.conf:80)
ServerRoot: "C:/xampp56/apache"
Main DocumentRoot: "C:/xampp56/htdocs"
Main ErrorLog: "C:/xampp56/apache/logs/error.log"
Mutex ssl-cache: using_defaults
Mutex default: dir="C:/xampp56/apache/logs/" mechanism=default
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
PidFile: "C:/xampp56/apache/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG