简体   繁体   English

apache虚拟主机设置不起作用

[英]apache vhost setup doesnt work

First things first .. im pretty new to apache configuration. 首先,.. im对apache配置来说还是很新的。

I'm trying to configure vhosts locally for an apache (Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3 according to phpinfo()). 我正在尝试在本地为Apache配置虚拟主机(根据phpinfo(),Apache / 2.4.10(Win32)OpenSSL / 1.0.1i PHP / 5.6.3)。

Its set up via XAMPP (xampp-win32-5.6.3-0). 通过XAMPP(xampp-win32-5.6.3-0)进行设置。 Operating system is Windows 7 Home Premium SP1. 操作系统是Windows 7 Home Premium SP1。

So i already read some articles about setting up vhosts (also some in this forum). 因此,我已经阅读了一些有关设置虚拟主机的文章(在该论坛中也有一些文章)。 My host file looks as follows: 我的主机文件如下所示:

# 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

My C:\\xampp56\\apache\\conf\\extra\\httpd-vhosts.conf contains the following code: 我的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>

It is loaded in the C:\\xampp56\\apache\\conf\\httpd.conf file. 它已加载到C:\\ xampp56 \\ apache \\ conf \\ httpd.conf文件中。

Include conf/extra/httpd-vhosts.conf

The Module mod_log_config.so is also loaded in the httpd.conf 模块mod_log_config.so也已加载到httpd.conf中

LoadModule log_config_module modules/mod_log_config.so

(After all editing in the config files i saved them and restarted apache.) (在配置文件中进行所有编辑之后,我保存了它们并重新启动了Apache。)

When I type test.local (or http://test.local ) in FireFox it always says "test.local was not found". 当我在FireFox中键入test.local(或http://test.local )时,它总是说“找不到test.local”。 When i call up localhost however its working. 当我打电话给本地主机,但是它的工作。

I havn't found any answers yet except to check if the vhost and the host file are set up correctly (which seems to be the case here to me). 除了检查vhost和主机文件是否正确设置外,我还没有找到任何答案(在我看来情况就是如此)。

Sorry for the long post and I am sorry in case it's just some stupid mistake i made here. 对不起,我的帖子很长,很抱歉,如果这只是我在这里犯的一些愚蠢的错误。

Thx for any help! 感谢您的帮助!

EDIT: 编辑:

Here is also the output from the httpd -S command: 这也是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

I found the solution. 我找到了解决方案。 It was Avira blocking access to my host file .. disabled that option in avira and vhosts work fine now. 是Avira阻止了对我的主机文件的访问..禁用了avira中​​的该选项,vhosts现在可以正常工作了。

Beside that i needed admin rights which were not set for the account i was working with .. 除此之外,我还需要为我正在使用的帐户设置的管理员权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM