search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

限制 phpMyAdmin 存取 IP on Debian 6 [限定網站的存取IP] – jashliao部落格

限制 phpMyAdmin 存取 IP on Debian 6 [限定網站的存取IP]

資料來源:http://note.drx.tw/2012/08/phpmyadmin-limit-ip-debian-6.html

1. 環境設定
    ◆作業系統:Debian 6 stable (squeeze)。
    ◆phpMyAdmin 路徑:/usr/share/phpmyadmin。
    ◆允許 IP:192.168.1.1。
    ◆允許 IP 範圍:192.168.2.1 ~ 192.168.2.254。
    

2. 設定檔修改
    ◆Apache
        $ sudo vi /etc/phpmyadmin/apache.conf [Enter]
        Alias /phpmyadmin/  “/usr/share/phpmyadmin/”
        Alias /phpMyAdmin/  “/usr/share/phpmyadmin/”
        
                Options -Indexes FollowSymLinks
                AllowOverride All
                Order deny,allow
                Deny from all
                Allow from 192.168.1.1
                Allow from 192.168.2.0/24
                ErrorDocument 403 ok
                RewriteEngine On
        

        # Windows 上的 AppServ 預設路徑為 “C:/AppServ/www/phpMyAdmin”。
    
    
    ◆Nginx
        $ sudo vi /etc/nginx/nginx.conf [Enter]
        server {
         location /phpmyadmin {
                allow 192.168.1.1
                allow 192.168.2.0/24
                deny all;
                root /usr/share/;
                index index.php index.html index.htm;
                location ~ ^/phpmyadmin/(.+\.php)$ {
                    try_files $uri =404;
                    root /usr/share/;
                    #fastcgi_pass 127.0.0.1:9000;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
                    include /etc/nginx/fastcgi_params;
                }
                location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                    root /usr/share/;
                }
            }
            location /phpMyAdmin {
                rewrite ^/* /phpmyadmin last;
            }
        }    

 

 

 

 

 



熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦