无法在redhat linux服务器内部和外部访问phpmyadmin

lyr7nygr  于 2023-04-04  发布在  PHP
关注(0)|答案(1)|浏览(107)

我在redhat linux 8服务器上安装了lamp stack,apache,mysql,php安装成功。
但是安装了phpmyadmin后,内部和外部都无法访问。
在curl internally之后,我遇到了这个错误
curl 10.64.100.224/phpMyAdmin/

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="http://10.64.100.224/phpMyAdmin/">here</a>.</p> </body></html>

当我试图通过浏览器外部访问它时,我有
http://10.64.100.224/phpMyAdmin/

Forbidden You don't have permission to access this resource.

这是phpMyAdmin.conf文件

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/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 /usr/share/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>

有人能帮我解决这个问题吗?提前感谢!
我希望在内部和外部访问phpMyAdmin。

oknwwptz

oknwwptz1#

我遵循这些步骤,然后问题得到解决:

mkdir /usr/share/phpMyAdmin/tmp  
chmod 777 /usr/share/phpMyAdmin/tmp  
chown -R apache:apache /usr/share/phpMyAdmin  

systemctl restart httpd  

yum install -y policycoreutils-python-utils  

semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/phpMyAdmin/'  
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/phpMyAdmin/tmp(/.*)?"  

restorecon -Rv '/usr/share/phpMyAdmin/'

firewall-cmd --permanent --add-service=http  
firewall-cmd --reload

相关问题