在apache中找不到虚拟主机的WAMP服务器名称

时间:2014-05-31 19:20:19

标签: apache dns localhost wamp virtualhost

系统:Windows7 64位 WAMP服务器32位版本:Apache:2.4.9 MySQL:5.6.17 PHP:5.5.12 PHPMyAdmin:4.1.14 SqlBuddy:1.3.3 XDebug:2.2.5

我的问题是当我导航到我的项目“local.blamo1.com”时 - 通过WAMP“Localhost”chrome返回:“哎呀!Google Chrome无法找到local.blamo1.com”

我能够使用“localhost / local.blamo1.com”访问我的项目文件夹 - 但据我所知,这是不好的做法,因为它会通过一个目录甩掉服务器映射。我希望能够使用指定的服务器别名访问项目。我已经实现了以下内容......

的httpd-vhosts.conf 位置:“C:\ wamp \ bin \ apache \ apache2.4.9 \ conf \ extra \ httpd-vhosts.config”

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "c:/wamp/www">
        AllowOverride All
            Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/local.blamo1.com"
    ServerName local.blamo1.com
    ServerAlias local.blamo1.com
    <Directory  "c:/wamp/www/local.blamo1.com">
        AllowOverride All
            Require local
    </Directory>
</VirtualHost>

主机文件 位置:“C:\ Windows \ System32 \ drivers \ etc \ hosts”

# 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.
#   127.0.0.1       localhost
127.0.0.1 localhost
127.0.0.1 local.blamo1.com

#::1 localhost
#::1 local.blamo1.com

的httpd.conf 位置:“C:\ wamp \ bin \ apache \ apache2.4.9 \ conf \ httpd.conf

我没有评论这些行

Include conf/extra/httpd-vhosts.conf
LoadModule vhost_alias_module modules/mod_vhost_alias.so

当前诊断

Apache httpd -t return:“语法OK”

我认为这与我的DNS或端口或whatev有关 - 因为我没有足够的使用此级别的经验或DNS无法解析域名:

我试图ping项目后:

ping local.blamo1.com “Ping请求找不到主机local.blamo.com。请检查名称,然后重试。

请帮助我理解为什么我会遇到这个问题。我已经为此工作了一天半。如果您没有足够的信息来诊断问题,请道歉。我会在必要时提供更多信息。

我最好的。

2 个答案:

答案 0 :(得分:6)

我能够解决这个问题 - 这个帖子的道具:http://www.tweaksforgeeks.com/windows7/2011/02/windows-7-hosts-file-ignored

这个问题似乎是一个腐败的主机&#34;文件 - 我肯定知道的是,解决方案是删除hosts文件并使用旧文本创建一个新文件。因果关系是莫名其妙的。

答案 1 :(得分:0)

这解决了我的问题。经过几个小时的努力。事实证明我对主机文件不屑一顾。保存为txt,然后只删除扩展名以替换原始文件。

相关问题