待整理

Yishto 2021-08-20 21:46:56
Categories: Tags:

https://segmentfault.com/a/1190000022986287?utm_source=tag-newest

http://www.ttlsa.com/nginx/using-nginx-map-method/

https://www.jb51.cc/nginx/435097.html

https://blog.csdn.net/zzhongcy/article/details/86137326

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
split_clients $remote_addr $drawing {
75% "async";
* "default";
}

map $hostname $upstream_draw {
~*bjyt "draw.bjyt"; # bjyt dev
~*bjmd "draw.bjmd";
default "draw.bjyt"; # dev
}

upstream draw.bjyt {
server 10.216.128.127:80;
}

upstream draw.bjmd {
server 10.216.128.127:80;
}

// 渲染页面失败的运营是因为加载了 http 的资源, 强制为https即可

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
    location ~*  ^/index\.php$ {
# add_header Content-Type "text/plain; charset=utf-8";
error_page 414 = @proxy_414;
if ($arg_async = 1) {
set $drawing 'async';
}
if ($drawing != 'async') {
return 414;
}
if ( $args !~* "kw=" ) {
return 414;
}
if ($args ~* "v_ap=1") {
return 414;
}

add_header X-ASYNC 1;
proxy_set_header Host $host;
proxy_set_header Connection close;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Cookie $http_cookie;
proxy_pass http://$upstream_draw/so?kw=$arg_kw;
}

location @proxy_414 {
include fastcgi.conf;
include include/so.360kan.com/env.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param PRJ_PHP_INCLUDE_PATH .:/home/q/system/:/home/q/system/so.360kan.com/config/front:/home/q/php/:/usr/local/php/lib/php/;
}