关于Apache服务器不能访问,无权限,forbidden的各种问题

#######强力解决##########
修改服务器根目录(直接将你项目的文件夹复制过去,我的文件夹是pin,注意:修改之后的缺点,只能访问这一个项目了,哈哈  肯定不适合所有人,目前愁死我了,暂时这么解决)
#1.服务器访问的根目录,
DocumentRoot "e:/wamp/www/pin"
#2.将引用httpd-vhosts.conf这个文件的这一行代码注释掉
#Include conf/extra/httpd-vhosts.conf

--------------------------------------------------

Directory "e:/wamp/www/pin">
    #
    # 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
	#Require all granted   #添加允许外部访问


    #
    # Controls who can get stuff from this server.
    #

#   onlineoffline tag - don't remove
	Require all granted
    #Require local
</Directory>

还有一点,与上面的无关,如果有的人是因为修改了权限之后
在相关的目录下将Require local或者Require all denied这两句话修改为Require all granted
启动不了服务器了,那么……恢复到原来的初始状态,重启一下电脑之后在修改这句话,就可以了,我就是这么好的,只是一个建议,不知道适用不适用所有人。

出现"Forbidden You don't have permission to access this resource."错误提示通常是由于服务器配置或权限问题导致的。以下是两种常见情况及其解决方法: 1. Apache服务器配置问题: 当访问Apache服务器上的网站时,可能会出现"Forbidden"错误。这通常是由于服务器未正确配置所致。解决方法如下: - 确保目标文件或目录的权限设置正确。您可以使用以下命令更改文件或目录的权限: ```shell chmod 755 /path/to/file_or_directory ``` - 检查Apache配置文件中的目录权限设置。您可以编辑Apache的配置文件(通常是httpd.conf或apache2.conf),找到相关目录的配置,并确保具有正确的权限设置。例如,您可以添加以下行来允许所有用户访问目录: ```apache <Directory /path/to/directory> Require all granted </Directory> ``` - 重新启动Apache服务器以使更改生效。 2. PHP访问权限配置问题: 当使用PHP访问服务器上的资源时,也可能会出现"Forbidden"错误。这可能是由于PHP的访问权限配置不正确所致。解决方法如下: - 确保PHP文件或目录的权限设置正确。您可以使用以下命令更改文件或目录的权限: ```shell chmod 755 /path/to/file_or_directory ``` - 检查PHP配置文件(php.ini)中的open_basedir设置。确保该设置包含您要访问的目录。例如: ```ini open_basedir = /path/to/directory ``` - 重新启动Web服务器以使更改生效。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值