问答详情
源自:2-4 WAMPServer多站点配置

外部地址无法访问虚拟主机test01.com,求解?

系统:win10

wamp版本 3.0.6

Apache版本 2.4.23

本机可以访问test01.com

局域网内其他电脑不可以访问

httpd-vhosts.conf修改如下:

<VirtualHost *:80>
 ServerName test01.com
 DocumentRoot d:/wamp/www/test01
 <Directory  "d:/wamp/www/test01">
  Options +Indexes +Includes +FollowSymLinks +MultiViews
  AllowOverride All
  Require local
  Require all granted
 </Directory>

httpd.conf修改如下:(+斜体部分)

DocumentRoot "D:/wamp/www"
<Directory "D:/wamp/www">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options +Indexes +FollowSymLinks +Multiviews

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #

#   onlineoffline tag - don't remove
    Require local
    Require all granted
</Directory>

hosts文件加127.0.0.1 test01.com

提问者:慕粉4282406 2017-04-25 13:01

个回答

  • Svily_0
    2017-04-26 15:53:13
    已采纳

        可能是下面几点原因,楼主可以试一下

    1. 局域网中的其他主机要访问你本机上的网站的话,是需要你本机的iPv4地址的,不是直接输入test1.com就能访问的。本机ipv4地址在cmd下用ipconfig命令查看

        2.有可能是系统防火墙的原因。你可以关闭防火墙后再试试。

        3.httpd-vhosts.conf文件中  Require local  也应该一并注释掉

        4.还有就是hosts文件中添加的127.0.0.1是你的本机回路地址,别人的hosts文件里要修改成你的iPv4地址才行,不然别人的电脑就会出现自己请求访问自己的情况,当然无法访问了。

        


  • 慕粉4282406
    2017-04-26 12:00:33

    不允许访问,为什么?

  • 慕粉4282406
    2017-04-26 11:58:35

    输入ip提示 you don't have permission to access /on this server

  • Svily_0
    2017-04-25 21:15:32

    你是怎么访问的?直接输入的test1.com还是你本机的ip?