centos64i386下apache 403没有权限访问。
2013-05-31 18:50
369 查看
由于想看看一些html文档,放到centos的httpd服务下,但是一直提示403没有权限,恶心死我了。
index.html文件无法访问,但是改名成为 index2.html就可以访问呢,真是气死人了。
检查权限与用户组设置
================
由于 sudo service httpd restart 需要root权限,但是/etc/httpd/conf/httpd.conf里面
我修改过用户组为 apache:apache ,权限改成 -rw-r--r-- 644 ,-rwxr-xr-x 755 -rwxrwxrwx 777 都试过了,都是没有权限,狗日的apache,httpd,我root都777 了哪里没权限了,莫名其妙。
检查httpd.conf配置
==================
先把 /etc/httpd/conf.d/welcome.conf 关闭掉,省的访问主目录没有index.html 就跳转到默认页面。
vim /etc/httpd/conf.d/welcome.conf
注释掉,再修改下显示indexed 显示文件索引(如果没有index.html 等默认网页文件的话)将主目录的index.html重命名 index2.html,目的为了 indexed 显示文件索引。
httpd.conf 包含默认注释
发现 子目录都无法访问。好吧搜索下
通过apache 子目录 403 找到这个文章
http://hi.baidu.com/c4bbage/item/b6c4ef244bb9791e097508ac
看了后,我气死了,最讨厌的就是 告诉你你错了,但是你就是找不到哪里错误,它也不给你任何提示。selinux我才不学呢,直接关闭。
把SELINUX关闭掉,不重启使用一条命令setenforce 就可以了。
service httpd restart
index.html文件无法访问,但是改名成为 index2.html就可以访问呢,真是气死人了。
检查权限与用户组设置
================
由于 sudo service httpd restart 需要root权限,但是/etc/httpd/conf/httpd.conf里面
[root@arcsdexen1 html]# pwd /var/www/html [root@arcsdexen1 html]# ll 总用量 8 drwxr-xr-x. 10 root root 4096 5月 31 18:15 Help -rwxr-xr-x. 1 root root 7 5月 31 17:46 index2.html [root@arcsdexen1 html]# ll .. 总用量 16 drwxr-xr-x. 2 root root 4096 2月 22 19:18 cgi-bin drwxr-xr-x. 3 root root 4096 5月 29 16:12 error drwxr-xr-x. 3 root root 4096 5月 31 18:15 html drwxr-xr-x. 3 root root 4096 5月 29 16:13 icons [root@arcsdexen1 html]#
我修改过用户组为 apache:apache ,权限改成 -rw-r--r-- 644 ,-rwxr-xr-x 755 -rwxrwxrwx 777 都试过了,都是没有权限,狗日的apache,httpd,我root都777 了哪里没权限了,莫名其妙。
检查httpd.conf配置
==================
先把 /etc/httpd/conf.d/welcome.conf 关闭掉,省的访问主目录没有index.html 就跳转到默认页面。
vim /etc/httpd/conf.d/welcome.conf
# # This configuration file enables the default "Welcome" # page if there is no default index page present for # the root URL. To disable the Welcome page, comment # out all the lines below. # #<LocationMatch "^/+$"> # Options -Indexes # ErrorDocument 403 /error/noindex.html #</LocationMatch>
注释掉,再修改下显示indexed 显示文件索引(如果没有index.html 等默认网页文件的话)将主目录的index.html重命名 index2.html,目的为了 indexed 显示文件索引。
httpd.conf 包含默认注释
发现 子目录都无法访问。好吧搜索下
通过apache 子目录 403 找到这个文章
http://hi.baidu.com/c4bbage/item/b6c4ef244bb9791e097508ac
apache web子目录403 在Apache下访问cunlide的网站,网站的原始内容可以访问,但是有余URL Rewrite,不太会直接访问到子目录的内容。 但是,当在根目录下添加一个子目录加一些html的时候,访问就会报403错误。 其实Google还是一个好东西,大概就是由于Selinux引起的。所以,只要设置一下配置就好了: chcon -R -t httpd_user_content_t [目录名]
看了后,我气死了,最讨厌的就是 告诉你你错了,但是你就是找不到哪里错误,它也不给你任何提示。selinux我才不学呢,直接关闭。
把SELINUX关闭掉,不重启使用一条命令setenforce 就可以了。
#vim /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. #SELINUX=enforcing SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted #setenforce 0 #getenforce Permissive
service httpd restart
相关文章推荐
- apache svn 403 forbidden 总提示没有访问权限
- apache svn 403 forbidden 总提示没有访问权限
- apache配置多站点提示403没有权限
- apache2.2.22 嵌入式移植403访问权限问题(You don't have permission to access / on this server)
- Apache2.2.2 访问站点的时候报403无权限显示的解决办法
- apache外网访问403 权限错误解决方案
- 启动apache后访问系统,提示没有权限访问目录,报403错误。
- [zz]启动apache后访问系统,提示没有权限访问目录,报403错误。
- apache 403 权限拒绝访问
- 关于APACHE 无权限访问的问题 403 解决方案
- Apache修改根目录没有访问权限问题的解决
- Linux下文件如果没有权限不能被Apache访问
- apache提示网站目录或文件没有权限访问的解决办法
- 启动 apache2.4 出现 invalid command order 问题 【由于 PHP 访问权限 403 问题引起】
- iis aspx常见错误 没有对“C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files”的写访问权限。
- apache带访问的权限虚拟主机配置不成功,老是报403错误
- VMware 安装 Windows无法访问指定设备、路径或文件。你可能没有适当的权限访问该项目 拒绝访问
- 127.0.0.1无法访问,没有权限: GetObject
- 在IE中必须点击input file 控件的浏览按钮才能提交上传,否则没有权限 。js文件报拒绝访问,解决办法是将input file控件定位到你要点击的地方 ,并且input file做成透明的
- Swift - 判断是否有某功能访问权限,没有则提示,并自动跳转到设置页