AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 742859
Accepted
Tall boY
Tall boY
Asked: 2015-12-15 03:34:55 +0800 CST2015-12-15 03:34:55 +0800 CST 2015-12-15 03:34:55 +0800 CST

phpMyAdmin - 403 权限被拒绝 - Centos7

  • 772

我在 Centos7 上运行 apache 2.4.6 的服务器上安装了 phpMyAdmin,我收到错误,因为您无权访问此服务器上的 /phpmyadmin。

我的服务器 ip 是62.210.xx.xx 我62.210.xx.xx/phpmyadmin/从另一个 ip 远程浏览xx.xx.xx.xx

/etc/httpd/conf.d/phpMyAdmin.conf

# phpMyAdmin - Web based MySQL browser written in php
# 
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

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
       Require ip 62.210.xx.xx
     </RequireAny>
   </IfModule>

   <IfModule !mod_authz_core.c>
     # Apache 2.2
     #Order Deny,Allow
     #Allow from 127.0.0.1
     #Allow from ::1
     #Allow from 62.210.xx.xx
     #Deny from All
     Allow from All
   </IfModule>
</Directory>

<Directory "/usr/share/phpMyAdmin/setup/">
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
       Require ip 62.210.xx.xx
     </RequireAny>
   </IfModule>

   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Allow from 127.0.0.1
     Allow from ::1
     Allow from 62.210.xx.xx
     #Deny from All
     #Allow from All
   </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<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>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#
#<IfModule mod_security.c>
#    <Directory "/usr/share/phpMyAdmin/">
#        #SecRuleInheritance Off
#    </Directory>
#</IfModule>

我已经添加了行Require ip 62.210.xx.xx ,并Allow from 62.210.xx.xx按照此处其他问题的建议,但仍然无法正常工作。

请查看并建议任何可能的方法。

谢谢

更新它的工作,Require all granted但这Require mylocalIP不是我想要的,我只想从我的服务器 ip62.210.xx.xx或本地 ip 范围允许

apache-2.4
  • 3 3 个回答
  • 4749 Views

3 个回答

  • Voted
  1. Kobus
    2015-12-15T04:04:04+08:002015-12-15T04:04:04+08:00

    我认为您需要查看主要的 apache 配置以查看其中对访问目录的任何限制。要查找的配置是: Order deny,allow Deny fromall

    命令允许,拒绝所有人允许

    如果这不起作用,请检查文件系统上的权限。如果这不起作用,那么 phpadmin 是否是指向其他未涵盖的其他地方的符号链接: Order deny,allow Deny fromall

    命令允许,拒绝所有人允许

    HTH科布斯

    • 0
  2. Best Answer
    Tall boY
    2015-12-15T04:31:28+08:002015-12-15T04:31:28+08:00

    我在这个官方文档之后找到了一种让它工作的方法,当我从本地 ip 浏览时,我需要告诉 apache 我的本地 ip 范围。

    添加Require ip xxx.xx了xxx.xx我用于拨号连接的本地部分 IP 地址在哪里,如果您有专用 ip 添加完整 ip Require ip xxx.xxx.xxx.xxx。

    现在它的工作。

    我希望它也对其他人有所帮助。

    • 0
  3. Niranjaysingh Rajput
    2020-06-02T06:51:36+08:002020-06-02T06:51:36+08:00

    当我在我的 CentOS 7 VPS 中安装 PHPMyAdmin 时,我也遇到了同样的问题。我已通过添加此行来解决此问题Require all grant in the directory 部分。下面是一个例子。

    <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>
    

    注意:将 IP 地址替换为 127.0.0.1

    • 0

相关问题

  • SELinux 阻止 Apache 写入文件

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve