在 CentOS 8 Stream 上全新安装 phpMyAdmin 后,我遇到了“访问被拒绝”的问题。
只不过是简单的文字而已。
浏览器控制台显示:
Failed to load resource: the server responded with a status of 403 (Forbidden)
这/var/log/httpd/error_log
:
[Mon Apr 04 15:08:21.674947 2022] [proxy_fcgi:error] [pid XXX] [client XXX] AH01071: Got error 'Unable to open primary script: /var/www/html/phpmyadmin/index.php (Permission denied)'
我已将其安装在/var/www/html/phpmyadmin
.没有做什么特别的事情。
配置phpmyadmin.conf
为/etc/httpd/conf.d
:
Alias /phpmyadmin /var/www/html/phpmyadmin
<Directory /var/www/html/phpmyadmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
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>
<Directory /var/www/html/phpmyadmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
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>
还授予apache
:
[root@machine html]$ ll -a
total 4
drwxrwxrwx. 3 root root 24 Aug 3 2021 .
drwxr-xr-x. 5 root root 63 Feb 1 11:53 ..
drwxr-xr-x. 13 apache apache 4096 Mar 3 2022 phpmyadmin
我什么也没做。有人有主意吗?