Authored by chunhua.zhang

合并ufo的nginx到java的nginx

... ... @@ -8,7 +8,8 @@
prompt: "Start to change . Please Enter YES to continue."
private: no
- name: "switch_to_where"
prompt: "switch to qcloud, please enter [qq], switch to aws, enter [aws]"
prompt: "Please choose pch5 endpoint: [qq|aws]"
default: qq
private: no
vars_files:
... ...
... ... @@ -8,7 +8,7 @@
prompt: "Start to change . Please Enter YES to continue."
private: no
- name: "switch_to_where"
prompt: "switch to qcloud, please enter [qq], switch to aws, enter [aws]"
prompt: "Please choose ufo endpoint: [qq|aws]"
private: no
vars_files:
... ...
server {
listen 80 backlog=8192;
## for proxy
proxy_http_version 1.1;
proxy_set_header Connection "";
server_name 2.yohobuy.com ufoapi.yohoops.org;
access_log /Data/logs/nginx/ufo_access.log fenxi;
error_log /Data/logs/nginx/ufo_error.log;
set $real_ip "";
set $request_api_method "-";
set $request_udid "-";
set $request_uid "-";
# set_by_lua_file $real_ip conf/setup.lua;
# access_by_lua_file 'conf/lua/limit_api_flow.lua';
#################### reject http HEAD & status check / .ico quest #########
# HEAD REQUEST RETURN 405
if ( $request_method = HEAD ) {
return 200;
}
# nginx status check
location = /status_check {
default_type text/html;
return 200 'server is ok!';
}
# cdn check
location = /test.html {
return 200;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
#################### begin match 2.yohobuy.com #########################
# location / {
# rewrite_by_lua_file conf/redirect.lua;
# }
#################### end match 2.yohobuy.com #########################
location / {
limit_req zone=limit_ufo burst=10 nodelay;
proxy_redirect off;
proxy_pass http://ufogateway/ufo-gateway/;
proxy_set_header X-Real-IP $real_ip;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
}
# forward to node app
location ^~ /mapp/ {
proxy_redirect off;
proxy_pass http://10.66.16.6/mapp/;
proxy_set_header Host "2.yohobuy.com";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ~* .(txt)$ {
root /Data/local/openresty-1.9.15.1/nginx/html;
}
}
... ...
server {
listen 80;
server_name admin.ufo.yohobuy.com;
#charset koi8-r;
access_log /Data/logs/nginx/access_admin.ufo.yohobuy.com.log fenxi;
# only allow for office access
allow 218.94.75.58;
allow 218.94.75.50;
allow 218.94.77.166;
allow 106.38.38.146;
allow 106.39.86.227;
allow 106.39.86.228;
allow 106.39.86.226;
allow 106.38.38.147;
allow 172.31.0.0/16;
allow 10.66.0.0/16;
deny all;
location ^~ /ufoPlatform/ {
proxy_redirect off;
proxy_pass http://ufoplatform/ufoPlatform/;
proxy_set_header Host "admin.ufo.yohobuy.com";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
}
... ...
... ... @@ -188,7 +188,27 @@ http
keepalive 100;
}
#ufo-gateway
upstream ufogateway {
{% for i in groups['java-ufo-fore'] %}
server {{ i }}:8080 max_fails=5 fail_timeout=3s;
{% endfor %}
keepalive 32;
}
# ufo-gateway
upstream ufoplatform {
{% for i in groups['java-ufo-platform'] %}
server {{ i }}:8088 max_fails=5 fail_timeout=3s;
{% endfor %}
keepalive 100;
}
#upstream
fastcgi_next_upstream error timeout invalid_header http_500;
... ...