配置apache2.4时出现Forbidden You don't have permission to access / on this server. 问题解决方案
程序员文章站
2022-03-15 22:42:12
...
安装完wampserver后,通过127.0.0.1或localhost访问网页可以正常访问;
但是通过其他电脑对服务器的公网ip地址进行访问,一直显示forbid....如图:
查阅博客帖子,发现这个问题常规的解决办法是修改httpd.conf中的两处配置。
我的解决过程是
先将
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
修改为
<Directory />
Options FollowSymLinks
AllowOverride none
Require all granted
</Directory>
接着将
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/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
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
修改为
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
这两处配置修改完成后,保存,重启服务。。
结果发现还是不能通过公网ip访问服务器端的网页。
最后通过大佬的帖子得知,还需要修改httpd-vhost.conf的配置。
原帖链接:https://bbs.csdn.net/topics/390904273?list=23494857
最后,将 httpd-vhost.conf的配置按大佬的解决方案修改,保存,重启服务,成功通过鼓服务器的公网ip访问到网页。