2016-12-04 135 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