0

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

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

经过

Allow from all

什么都没发生。但是,当我尝试恢复旧配置时,没有任何效果,我无法访问 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>

我现在能做什么 ?

4

1 回答 1

0

如果你需要共享一个网站,你可以创建一个监听 80 端口(默认 http)的虚拟主机:

<VirtualHost *:80>

  DocumentRoot /var/www/my_web_site
  DirectoryIndex index.html

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

</VirtualHost>

然后从局域网内的另一台计算机上输入您的 IP 地址。

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

于 2013-09-03T20:42:05.593 回答