2017-03-18 75 views
0

我知道這已被問過很多次,但所有的答案似乎相同,都沒有爲我工作。phpmyadmin - 禁止 - 您沒有權限訪問/ phpmyadmin /在這臺服務器上

我想從本地主機以外的其他地方訪問phpmyadmin GUI。

我收到錯誤「禁止 - 您無權訪問此服務器上的/ phpmyadmin /」。在瀏覽器中。

我使用CentOS7,Apache 2.4.6和phpMyAdmin-4.4.15.10-1.el7。

我已經試過這樣:

<Directory /usr/share/phpMyAdmin/> 
    Order Allow,deny 
    Allow from all 
</Directory> 

<Directory /usr/share/phpMyAdmin/setup/> 
    Order Allow,deny 
    Allow from all 
</Directory> 

大多數人似乎認爲我可以這樣做:

<IfModule mod_authz_core.c> 
    # Apache 2.4 
    <RequireAny> 
     Require all granted 
    </RequireAny> 
</IfModule> 

或者:

<IfModule mod_authz_core.c> 
    # Apache 2.4 
    <RequireAny> 
     Require ip 192.168.1.6 
    </RequireAny> 
</IfModule> 

但什麼都沒有工作。

這是當前的狀態:

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

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

仍然得到:

故宮

您沒有權限訪問/ phpMyAdmin的/在此服務器上。

編輯 -

正如更多的信息,我已經停用SELinux和放在/ usr /共享/ phpMyAdmin的確信權限是否正確。

編輯再次 -

現在我已經試過這...

<Directory /usr/share/phpMyAdmin/> 
     Require all granted 
</Directory> 

<Directory /usr/share/phpMyAdmin/setup/> 
     Require all granted 
</Directory> 

這肯定是基本就能搞定,但我仍然得到錯誤?

回答

0

最終得到了這個工作。有一次幾個問題,這是在排除故障的主要問題的方式越來越...

首先,編輯phpMyAdmin.conf ...

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

    <IfModule mod_authz_core.c> 
    # Apache 2.4 
    <RequireAny> 
     Require ip 192.168.1.6 
    </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> 

OR

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

您還需要確保/ usr/share/phpMyAdmin不僅對Apache用戶可讀,而且可執行。我只是遞歸這chmodded 777

您還需要添加以下/etc/httpd/conf/httpd.conf中:

<IfModule dir_module> 
    DirectoryIndex index.html index.php 
</IfModule> 

檢查/ var /日誌/的httpd/error_log中看到什麼你的特定錯誤是在每一步。

3
<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 Allow,Deny 
    Allow from All 
    </IfModule> 
</Directory> 
+1

「要求所有授予」是關鍵 – Teddy

相關問題