phpmyadmin不能访问,APACEH报403错误的另外一种解决办法

简介:

Permission denied: access to /phpmyadmin/ denied

网络上有很多种解决办法,修改CONF文件,停用SELINUX等。

我试过,都解决得不太理想。

通过以下这个贴子,我解决了问题。

URL如下:

http://sanartisan.wordpress.com/2012/04/19/apache-on-centos-6-2-with-sub-directories/

The problem was that the phpmyadmin package that I copied via WinSCP took the wrong context, which therefore didn’t have the appropriate permissions for apache to display.

[root@sandbox html]# ls -Z
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 info.php
drwxr-xr-x. root root unconfined_u:object_r:user_tmp_t:s0 phpmyadmin

To fix this, I needed to do the following:

chcon -R -t httpd_sys_content_t phpmyadmin

Note: be sure to use the -R to recursively apply that context against all files. Otherwise you will get a server misconfiguration error.

[root@sandbox html]# ls -Z
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 info.php
drwxr-xr-x. root root unconfined_u:object_r:httpd_sys_content_t:s0 phpmyadmin

In retrospect, had I downloaded the file via wget directly into the /var/www/html directory, it would have already taken the proper context, and I would not have had the issue.

目录
相关文章
|
缓存 前端开发 JavaScript
PHP - Laravel 创建项目到服务器(nginx、apache)运行(附带目录结构)
PHP - Laravel 创建项目到服务器(nginx、apache)运行(附带目录结构)
578 0
|
弹性计算 网络协议 安全
【图文教程】阿里云服务器开放端口设置(超详细)
阿里云服务器端口怎么打开?云服务器ECS端口在安全组中开启,轻量应用服务器端口在防火墙中打开,阿里云服务器网以80端口为例,来详细说下阿里云服务器端口开放图文教程,其他的端口如8080、3306、443、1433也是同样的方法进行开启端口:
38557 2
|
存储 算法 异构计算
这就是算法:日常生活中的算法应用
这就是算法:日常生活中的算法应用
817 3
|
算法 搜索推荐 C语言
c语言写快速排序代码
c语言写快速排序代码
|
弹性计算 网络安全
阿里云服务器更换公网IP地址教程(两种情况)
阿里云服务器可以更换公网IP地址,有两种情况,云服务器创建6小时内可以免费更换公网IP地址,超过6小时后可以通过绑定弹性公网EIP的方式来更换IP地址
11510 0
阿里云服务器更换公网IP地址教程(两种情况)
|
关系型数据库 MySQL C#
Unable to connect to any of the specified MySQL hosts.
c#连接Mysql数据建立连接时提示:Unable to connect to any of the specified MySQL hosts. 出现此错误的原因是Server(数据库服务器IP地址填写错误) 当Server配置值是“(local)”或者是"(localhost)"时都会产生...
3379 0
|
设计模式 Java API
【设计模式】用Java实现职责链模式
责任链模式(Chain of Responsibility Pattern)是一种行为设计模式,它允许将请求沿着处理链进行传递,直到有一个处理者能够处理该请求。每个处理者都可以决定是否将请求传递给下一个处理者,从而形成一条处理链。
172 0
|
存储
阿里面试官:说一下ArrayList和LinkedList的区别?(2)
阿里面试官:说一下ArrayList和LinkedList的区别?
213 0
|
JavaScript Ubuntu 开发工具