为了账号安全,请及时绑定邮箱和手机立即绑定

外部地址无法访问虚拟主机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

正在回答

4 回答

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

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

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

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

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

    


0 回复 有任何疑惑可以回复我~
#1

慕粉4282406 提问者

非常感谢!
2017-04-26 回复 有任何疑惑可以回复我~

不允许访问,为什么?

0 回复 有任何疑惑可以回复我~

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

0 回复 有任何疑惑可以回复我~

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

0 回复 有任何疑惑可以回复我~
#1

慕粉4282406 提问者

test01.com
2017-04-26 回复 有任何疑惑可以回复我~
#2

慕粉4282406 提问者

不是本机ip
2017-04-26 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

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

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号