2016-12-04 72 views
1

我有一個關於登錄phpmyadmin的問題。phpmyadmin只登錄局域網

我想顯示phpmyadmin登錄頁面ONLY局域網
連接PC和手機。

這是我的信息。

的CentOS 7.2
的phpmyadmin 4.4.15.8
的Apache 2.4.6
PHP 7.0.13
MariaDB的10.1.19
我的服務器的pravate IP地址爲192.168.0.12
我routor是192.168.0.1

這裏是我當前的代碼(所有PC和設備可以看到phpadmin登錄頁。)
/etc/httpd/conf.d/phpMyAdmin.conf

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

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

回答

0

變化的Apache 2.4和phpMyAdmin的目錄由您所在地區的網絡線路:

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

    <IfModule mod_authz_core.c> 
    # Apache 2.4 
    <RequireAny> 
     Require local 
     Require ip 192.168.1 #HERE put your network address 
    </RequireAny> 
    </IfModule> 
</Directory> 

或者是更具體的

Require local 
Require ip 192.168.1.100 
Require ip 192.168.1.101