Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache Wampserver:localhost 403在从所有服务器添加允许后被禁止_Apache - Fatal编程技术网

Apache Wampserver:localhost 403在从所有服务器添加允许后被禁止

Apache Wampserver:localhost 403在从所有服务器添加允许后被禁止,apache,Apache,我试图让外部的人访问我的本地主机。我编辑了httpd.conf 替换文件 Allow from localhost Allow from 127.0.0.1 ::1 Allow from 127.0.0.1 借 什么也没发生。但是,当我尝试恢复旧配置时,没有任何效果,我无法访问localhost或127.0.0.1。我得到“403禁止” 我的httpd.config: DocumentRoot "c:/" <Directory "c:/wamp/www"> # #

我试图让外部的人访问我的本地主机。我编辑了httpd.conf 替换文件

Allow from localhost
Allow from 127.0.0.1 ::1
Allow from 127.0.0.1

什么也没发生。但是,当我尝试恢复旧配置时,没有任何效果,我无法访问localhost或127.0.0.1。我得到“403禁止”

我的httpd.config:

DocumentRoot "c:/"
<Directory "c:/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

    #
    # 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.
    #
    # Require all granted
    #   onlineoffline tag - don't remove
    Allow from localhost
    Allow from 127.0.0.1
    Allow from 127.0.0.1 ::1
</Directory>
DocumentRoot“c:/”
#
#选项指令的可能值为“无”、“全部”,
#或以下任何组合:
#索引包括以下符号链接符号链接所有者匹配执行CGI多视图
#
#请注意,“多视图”必须显式命名为*--“所有选项”
#不给你。
#
#期权指令既复杂又重要。请看
# http://httpd.apache.org/docs/2.4/mod/core.html#options
#了解更多信息。
#
选项索引跟随符号链接
#
#AllowOverride控制可在.htaccess文件中放置的指令。
#它可以是“全部”、“无”或关键字的任意组合:
#AllowOverride文件信息AuthConfig限制
#
允许超越所有
#
#控制谁可以从此服务器获取内容。
#
#要求所有授权
#onlineoffline标记-不删除
允许从本地主机
允许从127.0.0.1开始
允许从127.0.0.1::1开始

我现在可以做什么?

如果您需要共享网站,您只需创建一个虚拟主机,在端口80上侦听(默认http):


DocumentRoot/var/www/my\u网站
DirectoryIndex.html
不允许超限
然后从局域网内的另一台计算机输入您的IP地址


如果您希望局域网外有人,您应该给他们您的公共IP地址,并确保打开并转发(从路由器设置)本地IP地址上的80端口。

您能给我们看一下httpd.conf配置吗?谢谢,我会尝试一下,但现在我甚至无法在本地访问我的服务器。我已经用实际的httpd.conf编辑了我的问题
DocumentRoot "c:/"
<Directory "c:/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

    #
    # 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.
    #
    # Require all granted
    #   onlineoffline tag - don't remove
    Allow from localhost
    Allow from 127.0.0.1
    Allow from 127.0.0.1 ::1
</Directory>
<VirtualHost *:80>

  DocumentRoot /var/www/my_web_site
  DirectoryIndex index.html

  <Directory /var/www/my_web_site>    
    AllowOverride none
  </Directory>

</VirtualHost>