首先要做的事情..对于apache配置来说,这是一个新手。
我正在尝试在本地为vache配置vhost (根据phpinfo()),Apache / 2.4.10(Win32)OpenSSL / 1.0.1i PHP / 5.6.3。
通过XAMPP(xampp-win32-5.6.3-0)进行设置。 操作系统是Windows 7 Home Premium SP1。
所以我已经阅读了一些关于设置vhosts的文章(在本论坛中也有一些)。 我的主机文件如下所示:
# 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>
它加载在C:\ xampp56 \ apache \ conf \ httpd.conf文件中。
Include conf/extra/httpd-vhosts.conf
模块mod_log_config.so也加载到httpd.conf
中LoadModule log_config_module modules/mod_log_config.so
(在配置文件中进行了所有编辑后,我保存了它们并重新启动了apache。)
当我在FireFox中输入test.local(或http://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
答案 0 :(得分:0)
我找到了解决方案。 这是Avira阻止访问我的主机文件..禁用avira和vhosts中的选项现在工作正常。
除此之外我还需要管理员权限,而这些管理权限并非为我正在使用的帐户设置..