1.负载均衡

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
在http模块下添加
upstream videoapi {
#weigth参数表示权值,权值越高被分配到的几率越大
server localhost:8080 weight=1;
server localhost:8082 weight=2;
}

修改
server {
listen 80;
server_name videoapi.site;

#反代
location / {
#访问http://videoapi
proxy_pass http://videoapi;
proxy_redirect default;
}
}

2.字符替换

通过sub_filter 替换相应的字符
之前想调试某个网站,但他加了反调试代码,通过我的服务器反代,删除代码,轻松解决

1
2
3
4
5
location /video/playUrl {
proxy_pass http://localhost:8082/video/playUrl;
#去除防debug
sub_filter "\x73\x65\x74\x49\x6e\x74\x65\x72\x76\x61\x6c\x28\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x29\x7b\x5f\x30\x78\x31\x63\x38\x66\x36\x63\x28\x29\x7d\x2c\x34\x30\x30\x30\x29\x3b\x76\x61\x72\x20\x5f\x30\x78\x31\x63\x38\x66\x36\x63\x3d\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x29\x7b\x66\x75\x6e\x63\x74\x69\x6f\x6e\x20\x5f\x30\x78\x34\x37\x63\x37\x39\x65\x28\x5f\x30\x78\x35\x39\x65\x62\x31\x39\x29\x7b\x69\x66\x28\x28\x22\x22\x2b\x5f\x30\x78\x35\x39\x65\x62\x31\x39\x2f\x5f\x30\x78\x35\x39\x65\x62\x31\x39\x29\x5b\x22\x6c\x65\x6e\x67\x74\x68\x22\x5d\x21\x3d\x3d\x31\x7c\x7c\x5f\x30\x78\x35\x39\x65\x62\x31\x39\x25\x32\x30\x3d\x3d\x3d\x30\x29\x7b\x28\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x29\x7b\x7d\x5b\x22\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72\x22\x5d\x28\x22\x64\x65\x62\x75\x67\x67\x65\x72\x22\x29\x28\x29\x29\x7d\x65\x6c\x73\x65\x7b\x28\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x29\x7b\x7d\x5b\x22\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72\x22\x5d\x28\x22\x64\x65\x62\x75\x67\x67\x65\x72\x22\x29\x28\x29\x29\x7d\x5f\x30\x78\x34\x37\x63\x37\x39\x65\x28\x2b\x2b\x5f\x30\x78\x35\x39\x65\x62\x31\x39\x29\x7d\x74\x72\x79\x7b\x5f\x30\x78\x34\x37\x63\x37\x39\x65\x28\x30\x29\x7d\x63\x61\x74\x63\x68\x28\x5f\x30\x78\x32\x62\x66\x38\x38\x61\x29\x7b\x7d\x7d\x3b\x5f\x30\x78\x31\x63\x38\x66\x36\x63\x28\x29\x3b" '';
}

3.以json返回网站目录下文件信息

1
2
3
4
location /conf/ {
autoindex on;
autoindex_format json;
}