Phi*_*pxp 22 centos selinux phpmyadmin
当我想访问我的phpMyAdmin时,我总是收到此消息.
w3m localhost/phpmyadmin
Forbidden
You don't have permission to access /phpmyadmin/ on this server.
Apache/2.2.15 (CentOS) Server at localhost Port 80
Run Code Online (Sandbox Code Playgroud)
安装步骤:
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2- 2.el6.rf.x86_64.rpm
yum install phpmyadmin
Run Code Online (Sandbox Code Playgroud)
添加别名
vi /etc/httpd/conf.d/phpmyadmin.conf
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin
Run Code Online (Sandbox Code Playgroud)
从cookie更改为http
vi /usr/share/phpmyadmin/config.inc.php
[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]
Run Code Online (Sandbox Code Playgroud)
重新开始
/etc/init.d/httpd restart
Run Code Online (Sandbox Code Playgroud)
SELinux - /etc/httpd
drwxr-xr-x. root root system_u:object_r:httpd_config_t:s0 .
drwxr-xr-x. root root system_u:object_r:etc_t:s0 ..
drwxr-xr-x. root root system_u:object_r:httpd_config_t:s0 conf
drwxr-xr-x. root root system_u:object_r:httpd_config_t:s0 conf.d
lrwxrwxrwx. root root system_u:object_r:httpd_log_t:s0 logs -> ../../var/log/httpd
lrwxrwxrwx. root root system_u:object_r:httpd_modules_t:s0 modules -> ../../usr/lib64/httpd/modules
lrwxrwxrwx. root root system_u:object_r:httpd_config_t:s0 run -> ../../var/run/httpd
Run Code Online (Sandbox Code Playgroud)
SELinux - /usr/share/phpmyadmin
drwxr-xr-x. root root system_u:object_r:usr_t:s0 .
drwxr-xr-x. root root system_u:object_r:usr_t:s0 ..
-rw-r--r--. root root system_u:object_r:usr_t:s0 browse_foreigners.php
-rw-r--r--. root root system_u:object_r:usr_t:s0 calendar.php
-rw-r--r--. root root system_u:object_r:usr_t:s0 changelog.php
-rw-r--r--. root root system_u:object_r:usr_t:s0 chk_rel.phph
.
.
.
-rw-r--r--. root root system_u:object_r:usr_t:s0 view_create.php
Run Code Online (Sandbox Code Playgroud)
OS
centos-release-6-0.el6.centos.5.x86_64
Run Code Online (Sandbox Code Playgroud)
Tar*_*req 31
编辑httpd.conf文件,如下所示:
# nano /etc/httpd/conf/httpd.conf
Run Code Online (Sandbox Code Playgroud)
在这里添加以下行:
<Directory "/usr/share/phpmyadmin">
Order allow,deny
Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)
发出以下命令:
# service httpd restart
Run Code Online (Sandbox Code Playgroud)
如果问题仍未解决,请禁用SELinux.
Hyd*_* B. 30
上面的配置都没有在我的CentOS 7服务器上工作.经过几个小时的搜索,这对我有用:
编辑文件phpMyAdmin.conf
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
并在顶部替换它:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
102403 次 |
| 最近记录: |