代码之家  ›  专栏  ›  技术社区  ›  Darren

WAMP虚拟主机不工作

  •  1
  • Darren  · 技术社区  · 16 年前

    请帮帮我,我正在拔头发。我无法让虚拟主机与WAMP一起工作。我取消了这一行的注释:

    # Virtual hosts
    Include conf/extra/httpd-vhosts.conf
    

    这是我的httpd-vhosts.conf文件:

    #
    # Virtual Hosts
    #
    # 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.2/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.
    
    #
    # Use name-based virtual hosting.
    #
    NameVirtualHost *:80
    
    #
    # VirtualHost example:
    # Almost any Apache directive may go into a VirtualHost container.
    # The first VirtualHost section is used for all requests that do not
    # match a ServerName or ServerAlias in any <VirtualHost> block.
    #
    <VirtualHost 127.0.0.1>
        DocumentRoot "C:\wamp\www"
        ServerName localhost
    </VirtualHost>
    <VirtualHost 127.0.0.1>
        DocumentRoot "C:\wamp\www\project\public"
        ServerName project
        ErrorLog "logs/project.localhost.error.log"
        CustomLog "logs/project.localhost.access.log" common
    </VirtualHost>
    

    我做错什么了?我的错误在哪里?为什么不显示我的虚拟主机?

    1 回复  |  直到 14 年前
        1
  •  0
  •   Darren    16 年前

    我找到了答案。我忘了在Windows主机文件中添加主机名。