检查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. 手势识别官方教程(7)识别缩放手势用ScaleGestureDetector和SimpleOnScaleGestureListener

    1.Use Touch to Perform Scaling As discussed in Detecting Common Gestures, GestureDetector helps you ...

  2. [转]Linux下chkconfig命令详解

    转自:http://www.cnblogs.com/panjun-Donet/archive/2010/08/10/1796873.html chkconfig命令主要用来更新(启动或停止)和查询系统 ...

  3. webHttpBinding+wsHttpBinding+basicHttpBinding的区别 (转)

    1. webHttpBinding (web AJAX/JSON)2. wsHttpBinding (ASP.NET client) 3. basicHttpBinding (Silverlight) ...

  4. conda python虚拟环境

    #查看已安装的python包 conda list #查看当前有哪些虚拟环境 conda env list 或者 conda info -e #更新conda conda update conda # ...

  5. oracle数据库忘记用户名和密码莫着急

    刚安装完Oracle 11g后,登录的时候没有记住用户名和密码,解决方法:新建一个用户 第一步:以系统身份登录 cmd--->sqlplus 提示输入用户名,然后输入sqlplus/as sys ...

  6. SAS学习笔记之《SAS编程与数据挖掘商业案例》(4)DATA步循环与控制、常用全程语句、输出控制

    SAS学习笔记之<SAS编程与数据挖掘商业案例>(4)DATA步循环与控制.常用全程语句.输出控制 1. 各种循环与控制 DO组 创建一个执行语句块 DO循环 根据下标变量重复执行DO和E ...

  7. Microsoft SQL Server学习(二)--数据库的语法

    关于数据库的语法 创建数据库 样例 名词概念 编写数据库代码的注意事项 关于文件语法 实例代码 关于数据库的语法: 1.创建数据库 create database 数据库名 on primary (主 ...

  8. ES6学习之箭头函数

    ES6学习笔记--箭头函数 箭头函数一直在用,最近突然想到重新看一下箭头函数的用法,所以这里做一些总结. 箭头函数长这个样子: let fn = a => a++; // fn 是函数名, a= ...

  9. SQLServer 异常捕获,回滚,再抛出

    一个存储过程中多个更新操作,后面的更新操作出现异常,如果不手动回滚前面修改的数据是不会自动撤销的! BEGIN TRY BEGIN TRAN -- ..... COMMIT TRAN END TRY ...

  10. Windows Server 2008无法远程连接

    Server 2008 R2依次配置好之后,重启发现总是远程桌面时而连接不上.具体现象如下: 偶尔可以通过桌面远程连接连接到Server.以为是防火墙的问题,各种设置——甚至关闭,依然无法连接.反复重 ...