And*_*les 2 apache dns wamp localhost 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>
Run Code Online (Sandbox Code Playgroud)
hosts文件位置:"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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
目前的诊断
Apache httpd -t返回:"语法OK"
我认为这与我的DNS或端口或whatev有关 - 因为我没有足够的使用此级别的经验或DNS无法解析域:
在我尝试ping项目之后:
ping local.blamo1.com"Ping请求找不到主机local.blamo.com.请检查名称,然后重试.
请帮助我理解为什么我会遇到这个问题.我已经为此工作了一天半.如果您没有足够的信息来诊断问题,请道歉.我会在必要时提供更多信息.
尽我所能.
我能够解决这个问题 - 这篇文章的道具:http://www.tweaksforgeeks.com/windows7/2011/02/windows-7-hosts-file-ignored
这个问题似乎是一个损坏的"主机"文件 - 我肯定知道的是解决方案是删除hosts文件并使用旧文本创建一个新文件.因果关系是莫名其妙的.
| 归档时间: |
|
| 查看次数: |
8329 次 |
| 最近记录: |