2014-11-05 150 views
0

我在我的VPS CentOS7中安裝了Apache,PHP,MariaDBPHPMyAdmin。但是,當我訪問的phpMyAdmin上您沒有權限訪問CentOS7中的此服務器上的/ phpMyAdmin VPS服務器

http://my-server-ip-here/phpMyAdmin 

它給這個錯誤:

Forbidden 

You don't have permission to access /phpMyAdmin on this server. 

我的配置,/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 my-server-ip-here 
     Require ip ::1 
    </RequireAny> 
    </IfModule> 
    <IfModule !mod_authz_core.c> 
    # Apache 2.2 
    Order Deny,Allow 
    # Deny from All 
    Allow from my-server-ip-here 
    Allow from ::1 
    </IfModule> 
</Directory> 

<Directory /usr/share/phpMyAdmin/setup/> 
    <IfModule mod_authz_core.c> 
    # Apache 2.4 
    <RequireAny> 
     Require ip my-server-ip-here 
     Require ip ::1 
    </RequireAny> 
    </IfModule> 
    <IfModule !mod_authz_core.c> 
    # Apache 2.2 
    Order Deny,Allow 
    #Deny from All 
    Allow from my-server-ip-here 
    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> 

回答

2

您將需要添加您的IP地址或範圍下允許部分phpMyAdmin.conf能夠遠程訪問您的phpMyAdmin。修改phpMyAdmin.conf後需要重新啓動httpd服務。

如果你的IP是123.456.789.1則:

<Directory /usr/share/phpMyAdmin/> 
    AddDefaultCharset UTF-8 

    <IfModule mod_authz_core.c> 
    # Apache 2.4 
    <RequireAny> 
     Require ip my-server-ip-here 
     Require ip ::1 
     Require ip 123.456.789.1 #add your IP 
    </RequireAny> 
    </IfModule> 
    <IfModule !mod_authz_core.c> 
    # Apache 2.2 
    Order Deny,Allow 
    # Deny from All 
    Allow from my-server-ip-here 
    Allow from ::1 
    Allow from 123.456.789.1 #add your IP 
    </IfModule> 
</Directory> 
+0

它在''我的服務器,IP-here'' – devo 2014-11-05 17:22:55

+0

那麼,你是從本地主機連接的地方已經加入? – cOle2 2014-11-05 17:23:48

+0

沒有人使用這種IP訪問http://123.456.789.1/phpMyAdmin。並使用SSH安裝軟件。 – devo 2014-11-05 17:28:07