nginx配置白名单
配置如下:
http模块:
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
geo $remote_addr $geo {
default 0; #0表示禁止访问
127.0.0.1 1; #1表示可以访问
}
include /usr/local/nginx/conf.d/*.conf;
}
server模块:
server {
listen 80;
server_name jenkins.aa.bb;
location / {
# 如果不是白名单则 显示403 禁止访问
if ( $geo = 0 ) {
return 403;
}
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Fix the "It appears that your reverse proxy set up is broken" error.
#proxy_pass http://127.0.0.1:9792;
proxy_pass http://127.0.0.1:59932;
proxy_read_timeout 90;
#proxy_redirect http://127.0.0.1:9792 https://jenkins.qinhej.top;
#Required for new HTTP-based CLI
proxy_http_version 1.1;
proxy_request_buffering off;
}
}
nginx配置白名单的更多相关文章
- nginx 配置白名单
在http 模块 增加 geo $remote_addr $ip_whitelist{ default 0; include white_ip.conf; } 在location 模块 增加 (注意i ...
- nginx的白名单
为nginx设置白名单的几个步骤: 第一步:指定能访问的白名单 vim /etc/nginx/ip.conf (如果在公司,记得这里是外网IP,要不然测很久都不知道为什么不行) ; 第二步 ...
- servlet过滤器配置白名单、黑名单
1.web.xml配置 <filter> <description>过滤是否登陆</description> <filter-name>encoding ...
- nginx限速白名单配置
在<nginx限制连接数ngx_http_limit_conn_module模块>和<nginx限制请求数ngx_http_limit_req_module模块>中会对所有的I ...
- nginx访问白名单设置以及根据$remote_addr分发
在日常运维工作中,会碰到这样的需求:设置nginx的某个域名访问只对某些ip开放,其他ip的客户端都不能访问.达到这样的目的一般有下面两种设置方法:(1)针对nginx域名配置所启用的端口(一般是80 ...
- Nginx IP 白名单设置
1:ip.config 192.168.3.15 1;192.168.3.10 1;192.168.0.8 1; 2:nginx.conf #geoIP的白名单 geo $remote_addr $i ...
- Confluence 6 配置白名单
Confluence 管理员可以通过添加 URLs 到白名单选择出入的链接和使用 RSS 宏,HTML 包含宏和小工具中的内容. 如果一个内容被添加到 Confluence 系统中,但是这个 URLs ...
- ubuntu apache2.4.7配置白名单
1.仅允许192.168.1.1访问,此处需要注意apache2.2和2.4版本之后白名单配置的方法是不一样的 <Directory /var/www/> Options FollowSy ...
- 【Azure Redis 缓存 Azure Cache For Redis】在创建高级层Redis(P1)集成虚拟网络(VNET)后,如何测试VNET中资源如何成功访问及配置白名单的效果
当使用Azure Redis高级版时候,为了能更好的保护Redis的安全,启用了虚拟网路,把Redis集成在Azure中的虚拟网络,只能通过虚拟网络VENT中的资源进行访问,而公网是不可以访问的.但是 ...
随机推荐
- 15 IO流(十二)——数据流Data InputStream/OutputStream 未学会
数据流的引入 Data流的父类是Filter抽象基类,也就是说Data流是装饰流. 数据流可以将数据的类型也一起传输. 数据流的读取写入顺序(数据类型的读写顺序)需要一致. 未完成代码 /** *Da ...
- flask框架(四)——flask CBV视图类解析
CBV视图类的两种基本写法 #第一种写法class IndexView(views.View): methods = ['GET'] decorators = [auth, ] def dispatc ...
- Python3定时器任务代码
使用threading写的一个定时器任务demo: import time import sys import signal import datetime import threading #定时器 ...
- pyenv基本使用
pyenv使用 1.安装: git clone https://github.com/pyenv/pyenv.git 2.配置pyenv环境变量 echo 'export PYENV_ROOT=&qu ...
- dubbo中使用动态代理
dubbo的动态代理也是只能代理接口 源码入口在JavassistProxyFactory中 public class JavassistProxyFactory extends AbstractPr ...
- Jenkins + GitLab + SpringBoot 实现持续集成脚本
Linux脚本 #!/bin/bash jar_name=hq-api.jar cd /usr/local/app/hq-api echo "Stopping SpringBoot Appl ...
- Codeforces Round #569 Div. 1
A:n-1次操作后最大值会被放到第一个,于是暴力模拟前n-1次,之后显然是循环的. #include<bits/stdc++.h> using namespace std; #define ...
- Oracle数据库常用语法
基本 --新建表:create table table1( id varchar(300) primary key, name varchar(200) not null); --插入数据 inser ...
- springboot 实时监控 spring-boot-starter-actuator 包
对java工程实时监控方式很多,本文主要讲在springboot框架中的监控. springboot框架,自带了actuator监控,在pom中引入jar包即可,如下 1.引入jar <depe ...
- MY SQL 两种安装方式
MySQL基础知识-安装MySQL 前导: 昨天去参加了一个面试,公司不太大,是一家日资企业,在国内有几家分公司,面试官问到了MySQL的基本操作和性能优化,说了一大堆,倒是比较轻松的过了,但是面 ...