程序员 linux命令 Python Android Firefox HTML5 微软 Windows centos linux mysql Ubuntu shell php wordpress nginx apache 开源 java google

nginx针对目录进行IP限制

Nginx phpmyadmin 针对内网ip用户开放、外网ip用户关闭

server {
  listen       80;
  server_name example.com;
  access_log logs/access.log main;
  location / {
      root   html;
      index index.PHP index.html index.htm;
  }
  location ~ ^/phpmyadmin/ {
      allow 192.168.1.0/24;
      deny all;
      location ~ .*.(php|php5)?$ {
          root /var/mailapp/nginx/html;
          fastcgi_pass   127.0.0.1:9000;
          fastcgi_index index.php;
          include        fastcgi_params;
      }
  }

 location ~ .*.(php|php5)?$ {
      root /opt/nginx/html;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index index.php;
      include        fastcgi_params;
   }
}

延伸阅读

评论