文档章节

Fixing Apache (13)Permission denied: access to / 403 Forbidden

中国模特演艺人才网
 中国模特演艺人才网
发布于 2017/09/13 14:22
字数 327
阅读 8
收藏 0

Every so often I run into a 403 Forbidden response when I'm setting up something in Apache, checking the log files will yield something like:

(13)Permission denied: access to /

There are a few things that could be the problem:

Make sure it's not denied by Apache

Most apache Configurations have something like this in there:

<Directory />
    Order deny,allow
    Deny from all
</Directory>

The above will block access to all files. You should also see something like this:

<Directory /path/to/webroot>
    Order allow,deny
    Allow from all
</Directory>

So if you have created a VirtualHost or an Alias that does not fall under this /path/to/webroot apache will have denied access to it. The solution in that case is to add another Directory entry in your httpd.conf to allow access to that directory.

Make sure Apache has Read, Execute Permissions

The next thing to check is that Apache has read and execute permission (rx) on directories and read permission on files. You can run chmod 750 /dir (to give -rwxr-x--- permission) or chmod 755 /dir (to give -rwxr-xr-x permission), etc.

Make sure that the Directory Above has Execute Permission

This is the one that tends to get me. Suppose you are creating an Alias like this:

Alias /foo /tmp/bar/foo

Now you have made sure that apache can read and execute /tmp/bar/foo by running chmod 755 /tmp/bar/foo, but you also need to give Apache execute permission to /tmp/bar/ otherwise it cannot traverse the sub directory foo.

If Running Security Enhanced Linux (SELinux)

Another possibility for this error is that you are running SELinux (Security Enhanced Linux), inwhich case you need to use chcon to apply the proper security context to the directory. One easy way to do this is to copy from a directory that does work for example /var/www/

chcon -R --reference=/var/www /path/to/webroot

本文转载自:https://www.petefreitag.com/item/793.cfm

中国模特演艺人才网
粉丝 2
博文 20
码字总数 3116
作品 0
闵行
项目经理
私信 提问
apache /var/www/html/子目录没权限访问解决办法

今天在CentOS系统的Apache出现错误:Apache 403 error, (13)Permission denied: access to / denied,搞了好久才搞好,现在把解决办法分享出来。 CentOS系统 检查了一圈httpd.conf和目录权限...

陈栋
2016/11/19
3.2K
0
Nginx报错403 forbidden (13: Permission denied)的解决办法

由于开发需要,在本地环境中配置了LNMP环境,使用的是Centos 6.5 的yum安装,安装一切正常,但是由于默认网站文件夹比较奇葩,于是把网站文件用mv命令移动到了新的目录,并相应修改了配置文件...

undefine
2016/01/06
1K
0
Apache防盗链配置,Directory访问控制,FilesMatch进行访问控制

防盗链配置 通过限制referer来实现防盗链的功能 配置前,使用curl -e 指定referer 配置,/usr/local/apache2.4/conf/extra/httpd-vhosts.conf对应的虚拟网站增加如下内容,SetEnvIfNoCase Re...

野雪球
2018/11/19
25
0
centos中配置虚拟主机出现403错误

RT 配置内容如下 NameVirtualHost yx.text.net ServerName yx.text.net DocumentRoot /var/www/yingxin yingxin文件夹的权限设为了777 内有index.php文件内容为用作测试 浏览器输入yx.text.n...

whitexuans
2011/08/12
1K
4
Apache - 403错误

1.1.1 现象 安装完毕后,访问http://localhost:8080/,出现错误:HTTP 错误 403 - 禁止访问,即403 Forbidden:You don't have permission to access / on this server. 1.1.2 原因 马上打开......

tywali
2016/05/31
0
0

没有更多内容

加载失败,请刷新页面

加载更多

Mybatis Plus删除

/** @author beth @data 2019-10-17 00:30 */ @RunWith(SpringRunner.class) @SpringBootTest public class DeleteTest { @Autowired private UserInfoMapper userInfoMapper; /** 根据id删除......

一个yuanbeth
今天
4
0
总结

一、设计模式 简单工厂:一个简单而且比较杂的工厂,可以创建任何对象给你 复杂工厂:先创建一种基础类型的工厂接口,然后各自集成实现这个接口,但是每个工厂都是这个基础类的扩展分类,spr...

BobwithB
今天
5
0
java内存模型

前言 Java作为一种面向对象的,跨平台语言,其对象、内存等一直是比较难的知识点。而且很多概念的名称看起来又那么相似,很多人会傻傻分不清楚。比如本文我们要讨论的JVM内存结构、Java内存模...

ls_cherish
今天
4
0
友元函数强制转换

友元函数强制转换 p522

天王盖地虎626
昨天
5
0
js中实现页面跳转(返回前一页、后一页)

本文转载于:专业的前端网站➸js中实现页面跳转(返回前一页、后一页) 一:JS 重载页面,本地刷新,返回上一页 复制代码代码如下: <a href="javascript:history.go(-1)">返回上一页</a> <a h...

前端老手
昨天
5
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部