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 / 问题 / 599210
Accepted
Germano Massullo
Germano Massullo
Asked: 2014-05-29 11:56:11 +0800 CST2014-05-29 11:56:11 +0800 CST 2014-05-29 11:56:11 +0800 CST

phpmyadmin “禁止访问:您无权访问此服务器上的 /phpmyadmin。”

  • 772

我需要修改文件/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/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Allow,Deny 
    Allow from all
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <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
     Allow from All
     Allow from 127.0.0.1
     Allow from ::1
   </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>

当我进入 phpmyadmin 网页时,在收到错误消息之前没有提示我输入用户名和密码:Forbidden: You don't have permission to access /phpmyadmin on this server. 我的系统是 Fedora 20

apache-2.2
  • 5 5 个回答
  • 95671 Views

5 个回答

  • Voted
  1. Best Answer
    foobrew
    2014-05-29T14:50:09+08:002014-05-29T14:50:09+08:00

    查看您的 httpd 错误日志,看看它是否有关于拒绝的更具体信息:/var/log/httpd/error_log

    此外,如果 selinux 正在执行,请尝试将其关闭以进行测试:

    $ sudo setenforce 0
    $ getenforce
    

    与 /var/www/html 相比,查看您在 /usr/share/phpMyAdmin 上的权限

    $ ls -ld /usr/share/phpMyAdmin /var/www/html
    

    总有 d'oh!也检查一下...您是否在添加该配置后实际上重新启动/重新加载了网络服务器?

    $ apachectl restart
    
    • 3
  2. alexus
    2014-05-29T13:20:08+08:002014-05-29T13:20:08+08:00

    添加Allow from 10.10.10.10(替换10.10.10.10为您的 IP 地址),不要忘记重新启动 apache service httpd restart)。随意看看我的我把它上传到pastebin:http://pastebin.com/hvU3SGs1(第24、42行)。

    • 0
  3. emotality
    2015-02-22T04:56:44+08:002015-02-22T04:56:44+08:00

    编辑文件:sudo nano /etc/httpd/conf.d/phpMyAdmin.conf并将您的文件替换为以下内容:

    <Directory /usr/share/phpMyAdmin/>
       AddDefaultCharset UTF-8
       <IfModule mod_authz_core.c>
         # Apache 2.4
       </IfModule>
       <IfModule !mod_authz_core.c>
         # Apache 2.2
       </IfModule>
    </Directory>
    

    重启阿帕奇:service httpd restart

    (phpMyAdmin v4.0.10.8)

    • 0
  4. user326869
    2015-12-13T03:18:48+08:002015-12-13T03:18:48+08:00

    这是我的 phpmyadmyn.comf

    Alias /phpmyadmin "c:/wamp/apps/phpmyadmin4.1.14/"
    
    # to give access to phpmyadmin from outside 
    # replace the lines
    #
    # Require local
    #
    # by
    #
    # Require all granted
    #
    <Directory "c:/wamp/apps/phpmyadmin4.1.14/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        <IfDefine APACHE24>
           Require all granted
        </IfDefine>
        <IfDefine !APACHE24>
           Order Deny,Allow
           Deny from all
           Allow from localhost ::1 127.0.0.1
        </IfDefine>
     php_admin_value upload_max_filesize 128M
     php_admin_value post_max_size 128M
     php_admin_value max_execution_time 360
     php_admin_value max_input_time 360
     </Directory>
    
    • 0
  5. Diamond
    2015-12-13T03:48:31+08:002015-12-13T03:48:31+08:00

    您没有提到您是否已经配置.htaccess了文件以进行身份​​验证。你也应该发布它的内容。

    您需要将它放在/usr/share/phpMyAdmin目录下,并且可以包含类似的内容:

    AuthType Basic
    AuthName "Restricted Files"
    AuthUserFile /etc/apache2/.phpmyadmin.htpasswd
    Require valid-user
    

    此外,您还需要DirectoryIndex index.php在目录块中有该行。

    <Directory /usr/share/phpMyAdmin>
            Options FollowSymLinks
            DirectoryIndex index.php
            AllowOverride All
            [...]
    

    您只需要自定义您的<Directory "/usr/share/phpMyAdmin/">部件和 .htaccess 文件。为了安全起见,您可以保留其余部分。

    在此处查看详细的操作方法:如何在 CentOS 7 服务器上使用 Apache 安装和保护 phpMyAdmin

    • 0

相关问题

  • Apache Django Mod_Wsgi - 自动重新加载应用程序

  • Apache:对多个虚拟主机使用相同的目录指令

  • Apache 上的子域不工作 - 找不到服务器

  • PHP 作为 CGI 还是 Apache 模块?

  • 避免将某些丢失的文件记录到 Apache2 错误日志中

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