检查http.conf发现没错之后。查找资料后发现时selinux的问题,所以须要关闭这个服务:

1 vi /etc/sysconfig/selinux
2 SELINUX=enforcing
改为 SELINUX=disabled

重新启动后生效

不需重新启动 运行命令:

1 setenforce
0

*********************************************************

在CentOS5.3+MySQL 5.0.45 +Apache2.2.3 +PHP5.1.6中执行PHP程序出错



You don't have permission to access / on this server



装好apache+php+mysql后。

拷贝一份phpmyadmin过后执行出错:

You don't have permission to access / on this server



有人说把selinux关掉就好了



而我发现了这个原因和方法:

由于站点运行的权限,一般要Read from all httpd scripts and the daemon这个权限。



当系统内经过解压出来的目录是没有这个权限的。



我们要在html/下新建一个文件夹(这时会自己主动分为Read from all httpd scripts and the daemon权限)



然后把档案复制一份过来放进去(注意不是剪切)



执行试试看吧。



我就能够了。

CentOS5.3+MySQL 5.0.45 +Apache2.2.3 +PHP5.1.6(都是系统自带的)


*********************************************************

在终端输入   (更改站点根文件夹权限为755,非常多centos系统默觉得700)

[root@localhost ~]#   chmod  -R 755 /var/www/html/

然后重新启动

[root@localhost ~]#   /etc/init.d/httpd restart

*********************************************************

打开apache的配置文件httpd.conf。逐行检查。在大约快一半的地方有下面这段代码:



    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Deny from all


发现了吧。因为配置了php后,这里的“Deny from all”已经拒绝了一切连接。把该行改成“allow from all”,改动后的代码例如以下。问题解决。

Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    allow from all



系统是centos。You don't have permission to access / on this server.

在google上搜索了一下,大部分的解决方法就是。

 

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Deny from all



这里改成



   Options
Indexes FollowSymLinks

    AllowOverride None



我改了之后还是会出现上面的错误,于是看一下自己设定的工作文件夹权限。

Options ExecCGI Includes

改成以下这行设置后,显示正常。

Options Indexes FollowSymLinks

当訪问类unix操作系统上的/usr/local/apache2/htdocs/foo/bar.htm文件时,你收到了Permission Denied的错误。



首先,查看文件的訪问权限:

$ cd /usr/local/apache2/htdocs/foo

$ ls -l bar.htm


假设需要的话。就修复它们:

$ chmod 644 bar.html

对目录以及每一个父目录做同样的操作

 

(/usr/local/apache2/htdocs/foo,/usr/local/apache2/htdocs,/usr/local/apache2,/usr/local/,/usr):

$ ls -la

$ chmod +x

$ cd ..

$ #repeat up to the root

在一些系统上,可使用工具namei来列出各个路径上的不同组件的訪问权限,然后去发现是否有权限问题:

 

$ namei -m /usr/local/apache2/htdocs/foo/bar.html



CentOS出错You don't have permission to access on this server的更多相关文章

  1. Linux Centos7 Apache 訪问 You don't have permission to access / on this server.

    折腾了非常久,今天才找到了最正确的答案.感言真不easy. 百度出来的99%都是採集的内容.全都是错误的. You don't have permission to access / on this ...

  2. CentOS出错You don't have permission to access on this server

    之前配置phpmyadmin的时候,在浏览器上输入http://192.168.8.250/phpmyadmin/ 也遇到了You don't have permission to access on ...

  3. You don't have permission to access ××× on this server.

    之前开发项目一直在linux上用的xampp集成环境,前几天突然想移到window上面去. 開始在window上安装了一个集成环境(名字大概是 Uniform Service),把项目文件已过去, o ...

  4. php多站点配置以及Forbidden You don't have permission to access / on this server问题解决

    php多站点配置以及Forbidden You don't have permission to access / on this server问题解决 一.总结 一句话总结:我的问题是php的版本问 ...

  5. Forbidden You don't have permission to access / on this server PHP

    在新安装的谷歌游览器里,打不了PHP网站了,错误显示: Forbidden You don't have permission to access / on this server. 原因还是配置权限 ...

  6. wamp出现You don’t have permission to access/on this server提示的解决方法

    本地搭建wamp 输入http://127.0.0.1访问正常,当输入http://localhost/ apache出现You don't have permission to access/on ...

  7. yii安装 /You don't have permission to access on this server

    在安装yii的时候 ,当打开了init.bat进行配置的时候小黑本弹出了个小黑框立刻就关闭了,  进入cmd模式再打开init.bat就出现了"You don't have permissi ...

  8. wampserver You don't have permission to access / on this server. 解决 方法(转,正好碰到这样的事情了就转下来)

    最近在安装最近版wampserver 2.2 d时发现安装好后启动服务器,访问localhost显示You don't have permission to access / on this serv ...

  9. Forbidden You don't have permission to access / on this server. You don't have permission to access /phpmyadmin/ on this server. 解决办法

    Forbidden  You don't have permission to access / on this server.   解决办法 打开 httpd.conf 文件, 将 #   onli ...

随机推荐

  1. B树、B+树、红黑树、AVL树比较

    B树是为了提高磁盘或外部存储设备查找效率而产生的一种多路平衡查找树. B+树为B树的变形结构,用于大多数数据库或文件系统的存储而设计. B树相对于红黑树的区别 在大规模数据存储的时候,红黑树往往出现由 ...

  2. nginx下如何配置 ssl证书?腾讯云ssl证书为例!

    nginx下如何配置 ssl证书?腾讯云ssl证书为例! 目前为止,https已经成为一种趋势,想要开启https就需要ssl证书. 首先,为域名注册ssl证书. 腾讯云注册地址:https://cl ...

  3. fcc html5 css 练习3

    行内样式看起来是这样的 <h1 style="color: green"> .pink-text { color: pink !important; }         ...

  4. SAS学习笔记之《SAS编程与数据挖掘商业案例》(1)系统简介和编程基础

    SAS学习笔记之<SAS编程与数据挖掘商业案例>(1)系统简介和编程基础 1. SAS系统简介 1.1 SAS是先编译后执行的语言,data步标志着编译的开始. 数据指针:当前内存缓存区, ...

  5. 微信自定义分享功能实现Tips

    以MVC为例 前台js通过.post()方法传给后台特定Controller当前页面的url,后台获取后,进行处理: 1.获取access_token:https://mp.weixin.qq.com ...

  6. Nagios事件机制实践

    Nagios事件机制实践  blog地址:http://www.cnblogs.com/caoguo 一.事件触发执行脚本 [root@Nagios ~]# cd /usr/local/nagios/ ...

  7. Centos7 Openstack - (第二节)添加认证服务(Keystone)

    Centos7 install Openstack - (第二节)添加认证服务(Keystone) 我的blog地址:http://www.cnblogs.com/caoguo 根据openstack ...

  8. C/C++ 之dll注入

    #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <time.h> ...

  9. u-boot常用命令

    查看ip地址等信息 print tftp相关 设置ip地址 set ipaddr 192.168.1.5 设置tftp所在电脑ip set serverip 192.168.1.8 最后必须输入sav ...

  10. bootstrap中chosen控件样式有时会冲突

    加上这句话试试 $(".chosen-container").css("width","100%"); 或者 100%改成 100px试试