我试图让外面的人访问我的localhost。我编辑了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 forbidden'
我的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>
我现在能做什么?
答案 0 :(得分: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地址。
如果你想要局域网以外的人,你应该给他们你的公共IP地址,并确保你在本地IP地址上打开和转发(从路由器的设置)端口80.