在 Amazon Web Services EC2 上运行的 Red Hat Enterprise Linux 中禁止使用 phpmyadmin

Posted

技术标签:

【中文标题】在 Amazon Web Services EC2 上运行的 Red Hat Enterprise Linux 中禁止使用 phpmyadmin【英文标题】:phpmyadmin forbidden in Red Hat Enterprise Linux running on Amazon Web Services EC2 【发布时间】:2017-06-24 17:35:59 【问题描述】:

我无法在我的服务器中访问 phpmyadmin。我被禁止了。

操作系统版本:Red Hat Enterprise Linux Server release 7.3 (Maipo)

我已经在 *** 中检查了答案,但是我无法解决我的问题。 我使用命令行安装了 phpmyadmin。 运行 phpmyadmin 版本信息:4.5.4.1

我修改了 /etc/httpd/conf.d/phpMyAdmin.conf 中的值

我的服务器在 Amazon Web Services 免费层上运行。

这是 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 ip 127.0.0.1

#    Require ip ::1
# </RequireAny>
# </IfModule>
# <IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
# Deny from All
Allow from all
# Allow from 127.0.0.1

# Allow from ::1
# AllowOverride all
# Require all granted
# </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>

Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All

Allow from ::1
</IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>

【问题讨论】:

您必须确保 apache 正在运行,然后才能访问 phpmyadmin。尝试使用日志发布问题,在您的情况下,它可能是 apache-log。这样就可以帮助您找出问题所在,而不是四处寻找。 【参考方案1】:

您能告诉我您使用的是哪个版本的 apache apache 2.4 或 apache 2.2 吗? 假设 2.4 添加到你的httpd.conf

<Directory /usr/share/phpmyadmin>
    Options FollowSymLinks
    DirectoryIndex index.php
    AllowOverride All
</Directory>

您的以下设置限制您从浏览器访问。

Order Deny,Allow
Deny from All
Allow from ::1

重启你的 httpd (apache)

【讨论】:

我正在使用 Apache/2.4.6 (Red Hat Enterprise Linux)。我将 phpmyadmin 文件夹(从 www.phpmyadmin.net 下载)粘贴到 /var/www/html/ 中,现在我可以使用 phpmyadmin。在此之前,我使用 YUM INSTALL PHPMYADMIN 并被击中。 我认为这不是解决您面临的问题的正确方法,并且 yum 足以正确安装 PHPMyAdmin。无论如何很高兴看到你的工作。 是的,这并没有解决我的问题。将 phpmyadmin 粘贴到 html 中后,我无法访问它,直到我评论了这一行……​​别名 /phpmyadmin /usr/share/phpMyAdmin。如果尝试像这样访问 myadmin .. /phpMyAdmin 。我仍然收到禁止错误。

以上是关于在 Amazon Web Services EC2 上运行的 Red Hat Enterprise Linux 中禁止使用 phpmyadmin的主要内容,如果未能解决你的问题,请参考以下文章

text 如何使用Apache,PHP,MySQL设置Amazon Web Services EC2实例

使用 Amazon Web Services (EC2) 和 c# Windows Service/WCF 进行远程调试

在 Amazon Web Services EC2 上运行的 Red Hat Enterprise Linux 中禁止使用 phpmyadmin

使用 Amazon Web Services 自动安排 Scrapy Crawler

Amazon Web Services 开发人员用户权限

如何使用 ReactJS/NodeJS 一起部署到 Amazon Web Services (AWS)?