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

问题描述 投票:0回答:1

我在redhat linux 8 服务器上安装了lamp stack。 apache, mysql, php 安装成功。

但是安装了phpmyadmin后,内外都无法访问

在内部卷曲后我有这个错误

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。

php linux apache phpmyadmin redhat
1个回答
0
投票

我遵循了这些步骤,然后问题就解决了:

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  
© www.soinside.com 2019 - 2024. All rights reserved.