检查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. sql数据库中常用连接

    很简单的知识点,今天有点搞不清楚左外连接,右外连接:详见以下: --表stu id name 1, Jack 2, Tom 3, Kity 4, nono --表exam id grade 1, 56 ...

  2. 【Leetcode 3】Longest Substring Without Repeating Characters0

    Description: Given a string, find the length of the longest substring without repeating characters. ...

  3. Laravel (5.5.33) 加载过程---make方法(四)

    /** * Resolve the given type from the container. * * @param string $abstract * @return mixed */ publ ...

  4. python--9、进程池

    concurrent.futures模块 进程池中的进程是固定的,若是池中有任务结束后,等待的任务进来后由空闲的进程来处理. 导入方法三连发: from 标题的模块 import 如下:Process ...

  5. 一个例子理解ES6的yield关键字

    yield是什么 yield是ES6的新关键字,使函数暂停执行. 一个简单例子 function *countASb() { console.log('Show0:'); var a1 = yield ...

  6. mounted钩子问题

    recommend.vue <script type="text/ecmascript-6"> import Slider from 'base/slider/slid ...

  7. ionic4封装样式原理

    查看文档: https://www.cnblogs.com/WhiteCusp/p/4342502.html https://www.jianshu.com/p/bb291f9678e1 https: ...

  8. Linux下源码安装Peach-2.3.8教程

    在peach文件夹下运行 python peach.py ./samples/HelloWorld.xml 提示先安装4Suite-XML. 根据提示在dependences文件夹下安装,出现两次错误 ...

  9. Codeforces 919C - Seat Arrangements

    传送门:http://codeforces.com/contest/919/problem/C 给出一张n×m的座位表(有已占座位和空座位),请选择同一行(或列)内连续的k个座位.求选择的方法数. H ...

  10. 前端开发神器之chrome 综述

    作为前端工程师,也许你对chrome开发工具不陌生,但也谈不上对各个模块有深入了解. 本文主要是为chrome开发工具使用这个系列做个开篇. 参考资料: 谷歌开发者: https://develope ...