Authored by jimi

增加pch5配置

Showing 26 changed files with 1580 additions and 1 deletions
... ... @@ -126,7 +126,41 @@ http
server 10.66.16.101;
keepalive 100;
}
upstream xianyu-yohobuy-node {
server 10.66.16.101 weight=6 max_fails=2 fail_timeout=5s;
keepalive 100;
}
#upstream
upstream globalbs {
server 10.66.5.17:8080 weight=6 max_fails=5 fail_timeout=5s;
server 10.66.5.187:8080 weight=6 max_fails=5 fail_timeout=5s;
}
upstream globalbuyapi {
server 10.66.16.101 weight=6 max_fails=2 fail_timeout=5s;
}
upstream yohobuy-node {
server 10.66.16.101 weight=6 max_fails=2 fail_timeout=5s;
keepalive 100;
}
upstream yohobuy-shop-manage {
server 10.66.16.101;
}
upstream yohobuy-shops {
server 10.66.50.140:30016;
}
upstream yohobuy-platform {
server 10.66.50.140:8088;
}
upstream yohobuywap-node {
server 10.66.16.101 weight=6 max_fails=2 fail_timeout=5s;
keepalive 100;
}
#upstream
fastcgi_next_upstream error timeout invalid_header http_500;
... ...
... ... @@ -2,3 +2,20 @@
包括下面的模块:
- `activity.yoho.cn`: 活动模版生成的活动
- `golbal`: 活动模版生成的活动
```
存放了一些文件图标啥的
need download git@git.yoho.cn:web/yoho-global.git
COPY yoho-global/Websites/ /Data/PE/yoho-global-bs/Websites/
路径的文件的保存,采用http的默认的文件
/Data/local/nginx-1.8.0/html/
```
- `yohobuy-pc`: pc首页
```
location /sitemap_pc/ {
root /Data/PE/;
}
```
\ No newline at end of file
... ...
proxy_cache cache_one;
proxy_cache_valid 200 302 5m;
proxy_cache_valid 301 10m;
proxy_cache_valid any 5m;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
#proxy_cache_revalidate on;
proxy_cache_min_uses 3;
#proxy_cache_lock on;
... ...
local domain = "(www\\.)?yohobuy\\.com"
local guangDomain = "guang\\.yohobuy\\.com"
local listDomain = "list\\.yohobuy\\.com"
local searchDomain = "search\\.yohobuy\\.com"
local saleDomain = "sale\\.yohobuy\\.com"
local cartDomain = "cart\\.yohobuy\\.com"
local newDomain = "new\\.yohobuy\\.com"
local itemDomain = "item\\.yohobuy\\.com"
local shopDomain = "shop\\.yohobuy\\.com"
local brandDomain = "[^\\.]+\\.yohobuy\\.com"
local config = {
{
router = domain.."/",
cache = 1
},
{
router = domain.."/brands/?",
cache = 1
},
{
router = domain.."/woman/?",
cache = 1
},
{
router = domain.."/girls/?",
cache = 1
},
{
router = domain.."/kids/?",
cache = 1
},
{
router = domain.."/lifestyle/?",
cache = 1
},
{
router = newDomain.."/",
cache = 1
},
{
router = newDomain.."/woman/?",
cache = 1
},
{
router = newDomain.."/girls/?",
cache = 1
},
{
router = newDomain.."/kids/?",
cache = 1
},
{
router = newDomain.."/lifestyle/?",
cache = 1
},
{
router = domain.."/brands/plusstar",
cache = 1
},
{
router = domain.."/product/sale/?",
cache = 1
},
{
router = domain.."/product/outlets/?",
cache = 1
},
{
router = domain.."/product/students/?",
cache = 0
},
{
router = domain.."/product/pro_.*",
cache_key = {"scheme", "host", "uri"},
cache = 1
},
{
router = domain.."/signin\\.html",
cache_key = {"scheme", "host", "uri"},
cache = 0
},
{
router = domain.."/reg\\.html",
cache_key = {"scheme", "host", "uri"},
cache = 0
},
{
router = domain.."/product/sale/vip",
cache = 1
},
{
router = domain.."/product/sale/breakingYards",
cache = 1
},
{
router = domain.."/product/sale/newSale",
cache = 1
},
{
router = domain.."/product/sale/discount/detail",
cache = 1
},
{
router = domain.."/coupon/index",
cache = 1
},
{
router = domain.."/special/(\\d+)_(.*)\\.html",
cache = 1
},
{
router = guangDomain.."/",
cache = 0
},
{
router = guangDomain.."/index/index",
cache = 0
},
{
router = guangDomain.."/\\d*\\.html",
cache = 0
},
{
router = guangDomain.."/tags/index",
cache = 0
},
{
router = guangDomain.."/index/editor",
cache = 0
},
{
router = listDomain.."/",
cache = 1
},
{
router = listDomain.."/new",
cache = 1
},
{
router = searchDomain.."/",
cache = 0
},
{
router = saleDomain.."/",
cache = 1
},
{
router = cartDomain.."/",
cache = 0
},
{
router = shopDomain.."/",
cache = 0
},
{
router = itemDomain.."/",
cache = 1
},
{
router = itemDomain.."/product/pro_.*",
cache = 1
},
{
router = brandDomain.."/",
cache = 1
},
{
router = brandDomain.."/about",
cache = 1
},
{
router = brandDomain.."/product/shoplist/?",
cache = 1
}
}
return config
... ...
local domain = "m\\.yohobuy\\.com"
local guangDomain = "guang\\.m\\.yohobuy\\.com"
local listDomain = "list\\.m\\.yohobuy\\.com"
local searchDomain = "search\\.m\\.yohobuy\\.com"
local saleDomain = "sale\\.m\\.yohobuy\\.com"
local cartDomain = "cart\\.m\\.yohobuy\\.com"
local newDomain = "new\\.m\\.yohobuy\\.com"
local itemDomain = "item\\.m\\.yohobuy\\.com"
local brandDomain = "[^\\.]+\\.m\\.yohobuy\\.com"
local config = {
{
router = domain.."/",
cache = 1
},
{
router = domain.."/boys/?",
cache = 1
},
{
router = domain.."/girls/?",
cache = 1
},
{
router = domain.."/kids/?",
cache = 1
},
{
router = domain.."/lifestyle/?",
cache = 1
},
{
router = domain.."/channel",
cache = 0
},
{
router = domain.."/cate",
cache = 1
},
{
router = domain.."/product/pro_.*",
cache = 1
},
{
router = domain.."/product/show_.*",
cache = 1
},
{
router = domain.."/brands",
cache = 1
},
{
router = domain.."/brands/search",
cache = 1
},
{
router = domain.."/product/outlet/?",
cache = 1
},
{
router = domain.."/coupon/floor/?",
cache = 1
},
{
router = domain.."/activity/coupon/floor/?",
cache = 1
},
{
router = domain.."/product/outlet/activity",
cache = 1
},
{
router = domain.."/product/index/index",
cache = 1
},
{
router = domain.."/product/index/brand",
cache = 1
},
{
router = domain.."/product/new",
cache = 1
},
{
router = domain.."/product/sale/?",
cache = 1
},
{
router = domain.."/product/sale/discount",
cache = 1
},
{
router = domain.."/product/sale/vip",
cache = 1
},
{
router = domain.."/product/sale/breakingYards",
cache = 1
},
{
router = domain.."/product/sale/discount/detail",
cache = 1
},
{
router = guangDomain.."/",
cache = 1
},
{
router = guangDomain.."/index",
cache = 1
},
{
router = guangDomain.."/info/index",
cache = 1
},
{
router = guangDomain.."/tags/index",
cache = 1
},
{
router = guangDomain.."/plustar",
cache = 1
},
{
router = guangDomain.."/plustar/brandinfo",
cache = 0
},
{
router = guangDomain.."/author/index",
cache = 1
},
{
router = guangDomain.."/star",
cache = 1
},
{
router = guangDomain.."/plusstar",
cache = 1
},
{
router = listDomain.."/",
cache = 1
},
{
router = searchDomain.."/",
cache = 0
},
{
router = saleDomain.."/",
cache = 1
},
{
router = cartDomain.."/",
cache = 0
},
{
router = newDomain.."/",
cache = 0
},
{
router = itemDomain.."/",
cache = 0
},
{
router = brandDomain.."/",
cache = 1
},
{
router = domain.."/product/seckill/show_.*",
cache = 1
},
{
router = domain.."/product/seckill/?",
cache = 1
}
}
return config
... ...
function cache(router_config, opts)
local key = ngx.var.host .. ngx.var.uri
for k, v in ipairs(router_config) do
if ngx.re.match(key, "^"..v.router.."$") then
if v.cache == 1 then
ngx.var.cache_zone = opts.cache_zone
end
local cacheKey = ""
if v.cache_key ~= nil and #v.cache_key > 0 then
for i = 1, #v.cache_key do
if ngx.var[v.cache_key[i]] ~= nil then
cacheKey = cacheKey .. ngx.var[v.cache_key[i]]
end
end
ngx.var.cache_key = cacheKey
else
ngx.var.cache_key = ngx.var.scheme .. ngx.var.host .. ngx.var.uri .. (ngx.var.args and ngx.var.args or "")
end
break
end
end
end
return cache;
\ No newline at end of file
... ...
package.path = "/usr/local/openresty/nginx/conf/vhosts/lua_modules/?.lua;/usr/local/openresty/nginx/conf/vhosts/lua_modules/config/?.lua;"..package.path
local cache = require('lua_func')
local config = require('lua_pc_config')
local opts = { cache_zone = "cache_one_pc" }
cache(config, opts)
... ...
if #ngx.var.cache_key > 0 then
local function sendSocket(premature, message)
local socket = ngx.socket.udp()
socket:setpeername("10.66.1.150", 4444)
local ok, err = socket:send(message)
socket:close()
end
local message = ngx.var.influxtb..",key="..ngx.md5(ngx.var.cache_key).." full_key=\""..ngx.var.cache_key.."\",full_path=\""..ngx.var.scheme.."://"..ngx.var.host..ngx.var.request_uri.."\",router=\""..ngx.ctx.cache_router.."\",cache_status=\""..(ngx.var.upstream_cache_status or "").."\""
local ok, err = ngx.timer.at(0, sendSocket, message)
end
... ...
package.path = "/usr/local/openresty/nginx/conf/vhosts/lua_modules/?.lua;/usr/local/openresty/nginx/conf/vhosts/lua_modules/config/?.lua;"..package.path
local cache = require('lua_func')
local config = require('lua_wap_config')
local opts = { cache_zone = "cache_one_wap" }
cache(config, opts)
... ...
proxy_cache cache_one_pc;
proxy_cache_valid 200 1m;
proxy_cache_min_uses 1;
proxy_cache_revalidate on;
#proxy_cache_lock on;
proxy_cache_key $host$uri$args;
add_header X-Cache-Status $upstream_cache_status;
... ...
proxy_redirect off;
proxy_pass http://yohobuy-node;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $http_x_forwarded_for;
proxy_set_header X-Yoho-Real-IP $http_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
proxy_http_version 1.1;
proxy_set_header Connection "";
\ No newline at end of file
... ...
server {
listen 80;
server_name shopmanage.yohobuy.com;
#charset koi8-r;
access_log /Data/logs/nginx/access_shop_manage.yohobuy.com.log fenxi;
set $rewite 0;
if ($http_x_client_proto = 'http') {
set $rewite 1;
}
if ($http_x_forwarded_proto = 'http') {
set $rewite 1;
}
if ($rewite = 1) {
return 301 https://$host$request_uri ;
}
# nginx status check
location = /status_check {
default_type text/html;
return 200 'shopmanage.yohobuy.com - server is ok!';
}
location ^~ /platform/product/getRemoteImageUrlBySku {
proxy_redirect off;
proxy_pass http://yohobuy-platform/platform/product/getRemoteImageUrlBySku;
#proxy_set_header Host "shopmanage.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 /oldshops/ {
rewrite ^/oldshops/(.*)$ /$1 break;
proxy_redirect / /oldshops/;
proxy_pass http://yohobuy-shops;
proxy_set_header Host "shops.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 / {
proxy_redirect off;
#proxy_pass http://yohobuy-shop-manage-gray;
proxy_pass http://yohobuy-shop-manage;
proxy_set_header Host "shopmanage.yohobuy.com";
proxy_set_header X-Real-IP $http_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
#chunked_transfer_encoding off;
}
location /shops-proxy/ {
proxy_redirect off;
proxy_pass http://yohobuy-shops;
proxy_set_header Host "shops.yohobuy.com";
proxy_set_header X-Real-IP $http_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ~* /(static|assets)/ {
proxy_redirect off;
proxy_pass http://yohobuy-shops;
proxy_set_header Host "shops.yohobuy.com";
proxy_set_header X-Real-IP $http_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
}
... ...
location =/app.html {
access_log /Data/logs/nginx/yohobuywap-node/access.m.yohobuy.com.log fenxi;
return 301 http://www.yoho.cn;
}
location =/yohood.html {
access_log /Data/logs/nginx/yohobuywap-node/access.m.yohobuy.com.log fenxi;
return 301 http://www.yohood.cn/;
}
location ^~ /home/lottery {
access_log /Data/logs/nginx/yohobuywap-node/access.m.yohobuy.com.log fenxi;
return 301 https://m.yohobuy.com;
}
location ^~ /wechat {
access_log /Data/logs/nginx/yohobuywap-node/access.m.yohobuy.com.log fenxi;
return 301 https://m.yohobuy.com;
}
location ^~ /huodong {
access_log /Data/logs/nginx/yohobuywap-node/access.m.yohobuy.com.log fenxi;
return 301 https://m.yohobuy.com;
}
location ^~ /download {
access_log /Data/logs/nginx/yohobuywap-node/access.m.yohobuy.com.log fenxi;
return 301 http://www.yoho.cn;
}
location ^~ /appactive {
access_log /Data/logs/nginx/yohobuywap-node/access.m.yohobuy.com.log fenxi;
return 301 http://www.yoho.cn;
}
location =/product/new/index {
return 301 http://m.yohobuy.com/product/new;
}
#old idc
location =/download/appsem {
return 301 http://cdn.yoho.cn/huodong-web/appsem/appsem.html;
}
location =/app {
return 301 http://www.yoho.cn;
}
location =/help.html {
return 301 http://m.yohobuy.com/home/help;
}
location ^~ /trends_detail_ {
return 301 http://guang.m.yohobuy.com;
}
#301
location = /girl {
return 301 http://m.yohobuy.com/girls;
}
location =/invite.html {
return 301 http://m.yohobuy.com/activity/invite/index?$args;
}
location ^~ /share_ {
return 301 http://m.yohobuy.com/activity/invite$request_uri;
}
location = /coupon/index {
return 301 /activity/coupon?$query_string;
}
location = /life {
return 301 https://m.yohobuy.com;
}
location = /life/sendCoupon {
return 301 https://m.yohobuy.com;
}
location = /life/login {
return 301 https://m.yohobuy.com;
}
location = /life/coupon {
return 301 https://m.yohobuy.com;
}
location = /life/getSignPackage {
return 301 https://m.yohobuy.com;
}
location = /download/mkapp {
return 301 https://union.yoho.cn/union/app-downloads.html;
}
location = /503.html {
default_type application/json;
if ($http_x_requested_with = XMLHttpRequest) {
return 200 '';
}
return 302 http://www.yohobuy.com/;
}
\ No newline at end of file
... ...
#app api
location =/appembed {
default_type application/json;
return 200 '{"code":200,"message":"app embed","data":{"open":"N","url":"http://m.yohobuy.com"}}';
}
location =/lb/v1 {
#cc: e0323a9039add2978bf5b49550572c7c oo:e47ca7a09cf6781e29634502345930a7
#acecl:7ea6bdf07376a928c5d4677789c45463 opqcl:kai: 352f028bd6ecf28de1c285c573642659 guang:7ea6bdf07376a928c5d4677789c45463
#srp 62a165d59f8daf42e2df5f3c5aed8a2f krp:17d7a40f313560d4d9a1189a91e45ab9
#boc 94931e4a3036baeecdacb975e10a8ec6 bcc:dc9262a469f6f315f74c087a7b3a7f35
default_type application/json;
return 200 '{"code":200,"message":"Config Success","md5":"e4567a9039add2978bf5b49550572cff","data":{"ae":"e0323a9039add2978bf5b49550572c7c","url":"http://m.yohobuy.com","tl":"352f028bd6ecf28de1c285c573642659","dl":"5b2d8b4b242e067616c6cd98851b2306","rp":"17d7a40f313560d4d9a1189a91e45ab9","dli":"2a90dfa0f37b92aaebf369e9a4d38ba4"}}';
}
location =/hf/v1 {
#proxy_redirect off;
#proxy_pass http://yohobuywap-node;
#proxy_set_header Host $host;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $http_x_forwarded_for;
#proxy_set_header Accept-Encoding "gzip";
default_type application/json;
return 200 '{"code": 200,"data": {"url": "http://cdn.yoho.cn/app-hotfix2/production/yohobuy/ios/4.7.0/102/main.js","patchv": "102","filecode": "a824fc9b41a828830d2e6472ad697519"},"md5": "ad92dda46040e4a8d55322356d7d98b7"}';
}
... ...
#set $cache_zone "off";
#set $cache_key "";
#set $influxtb "ngx_cache_wap";
#rewrite_by_lua_file conf/vhosts/lua_modules/lua_wap_cache.lua;
proxy_cache cache_one_wap;
proxy_cache_valid 200 1m;
#proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
#proxy_cache_revalidate on;
proxy_cache_min_uses 1;
#proxy_cache_lock on;
proxy_cache_key $host$uri$args;
#proxy_ignore_headers Cache-Control;
add_header X-Cache-Status $upstream_cache_status;
#log_by_lua_file conf/vhosts/lua_modules/lua_udp.lua;
# proxy_ignore_headers "Set-Cookie"; # 绝对不能加,加了存在串 sessionID 的隐患
... ...
proxy_cache cache_one_wap;
proxy_cache_valid 200 1m;
proxy_cache_min_uses 1;
proxy_cache_key $host$uri; # 忽略?后边的参数
add_header X-Cache-Status $upstream_cache_status;
# proxy_ignore_headers "Set-Cookie"; # 绝对不能加,加了存在串 sessionID 的隐患
\ No newline at end of file
... ...
#limit_req zone=limit_per_url_1000 burst=1000;
... ...
#channel page
location = / {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /boys {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /girls {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /kids {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /lifestyle {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /product/sale {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /product/outlet {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /product/pro_ {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /product/show_ {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /guang/plusstar {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /cate {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /product/new {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /home {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location = /sale {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /coupon/floor {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /cart/index/seckill {
#limit_req zone=limit_per_url_500 burst=500;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /product/seckill {
#req_limit
#limit_req zone=limit_per_url_500 burst=500;
#proxy
include vhosts/wap/node-proxy.conf;
}
location ^~ /guang {
#req_limit
include vhosts/wap/limit.conf;
#proxy
include vhosts/wap/node-proxy.conf;
}
#location ^~ /activity/feature {
# #cache config
# include vhosts/wap/force-cache.conf;
# #proxy
# include vhosts/wap/node-proxy.conf;
#}
location ^~ /chanpin/ {
proxy_ignore_headers "Cache-Control" "Expires" "Vary";
proxy_http_version 1.1;
proxy_set_header Connection "";
#proxy
include vhosts/wap/node-proxy.conf;
}
\ No newline at end of file
... ...
#lua cache
proxy_redirect off;
proxy_pass http://yohobuywap-node;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $http_x_forwarded_for;
proxy_set_header X-Yoho-Real-IP $http_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
\ No newline at end of file
... ...
#static file
#analytics wap topbanner
location =/activitylog.json {
default_type application/json;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
return 200 '{"code":200}';
}
location =/favicon.ico {
expires 7d;
}
location =/crossdomain.xml {
expires 7d;
}
location =/robots.txt {
expires 1d;
}
location = /error.html {
expires 7d;
}
# app show help page
location =/help/shareorder.html {
expires 7d;
}
## baidu feng322169 yoho9646
location = /baidu_verify_bXX90VTyvs.html {
expires 7d;
}
location = /hfxRaNY27L.txt {
expires 7d;
}
... ...
server {
listen 80;
server_name xianyu.yohobuy.com;
#charset koi8-r;
access_log /Data/logs/nginx/xianyu.yohobuy.com.log fenxi;
error_log /Data/logs/nginx/xianyu.yohobuy.com_error.log error;
# nginx status check
location = /status_check {
default_type text/html;
return 200 'xianyu.yohobuy.com server is ok!';
}
location / {
proxy_redirect off;
proxy_pass http://xianyu-yohobuy-node;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $http_x_forwarded_for;
proxy_set_header X-Yoho-Real-IP $http_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
}
\ No newline at end of file
... ...
server
{
listen 80;
server_name www.yohoblk.com;
access_log /Data/logs/nginx/www.yohoblk.com.log fenxi;
allow 218.94.75.58;
allow 218.94.75.50;
allow 202.241.189.22;
allow 153.215.46.190;
allow 218.94.77.166;
deny all;
# if ($scheme = http) {
# return 301 https://$server_name$request_uri;
# }
set $rewite 0;
if ($http_x_client_proto = 'http') {
set $rewite 1;
}
if ($http_x_forwarded_proto = 'http') {
set $rewite 1;
}
if ($rewite = 1) {
return 301 https://$host$request_uri ;
}
# nginx status check
location = /status_check {
default_type text/html;
return 200 'server is ok!';
}
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://yohoblk-pc;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; ";
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
server
{
listen 80;
server_name yohoblk.com;
allow 218.94.75.58;
allow 218.94.75.50;
deny all;
location / {
return 301 https://www.yohoblk.com$request_uri;
}
}
server
{
listen 80;
server_name m.yohoblk.com;
access_log /Data/logs/nginx/m.yohoblk.com.log fenxi;
set $rewite 0;
if ($http_x_client_proto = 'http') {
set $rewite 1;
}
if ($http_x_forwarded_proto = 'http') {
set $rewite 1;
}
if ($rewite = 1) {
return 301 https://$host$request_uri ;
}
# nginx status check
location = /status_check {
default_type text/html;
return 200 'server is ok!';
}
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://yohoblk-wap;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
\ No newline at end of file
... ...
server
{
listen 80;
server_name www.yohobuy.com *.yohobuy.com www.yhbimg.com;
root /Data/PE/yohobuy_pc/yohobuy/www.yohobuy.com/public;
access_log /Data/logs/nginx/access_pc.yohobuy.com.log fenxi;
error_log /Data/logs/nginx/error_pc.yohobuy.com.log warn;
######force https to http ######
set $rewite 0;
if ($http_x_client_proto = 'http') {
set $rewite 1;
}
if ($http_x_forwarded_proto = 'http') {
set $rewite 1;
}
# is windows xp
if ($http_user_agent ~* "NT 5.[0-9]+") {
set $rewite 0;
}
if ($rewite = 1) {
return 301 https://$host$request_uri ;
}
# nginx status check
location = /status_check {
default_type text/html;
return 200 'server is ok!';
}
location / {
if ($http_user_agent ~* "Scrapy") {
return 403;
}
if ($http_user_agent ~ ^$) {
return 403;
}
set $self_remote_addr $http_x_forwarded_for;
include vhosts/pc/cache.conf;
# proxy_ignore_headers "Set-Cookie"; # 绝对不能加,加了存在串 sessionID 的隐患
#req_limit
limit_req zone=allips burst=20 nodelay;
include vhosts/pc/node-proxy.conf;
}
location ~ \.html$ {
if ($http_user_agent ~* "spider") {
proxy_pass http://localhost:8088;
}
if ($http_user_agent ~* "Scrapy") {
return 403;
}
if ($http_user_agent ~ ^$) {
return 403;
}
set $self_remote_addr $http_x_forwarded_for;
include vhosts/pc/cache.conf;
limit_req zone=allips burst=20 nodelay;
include vhosts/pc/node-proxy.conf;
}
location = /favicon.ico {
expires 30d;
}
location = /crossdomain.xml {
expires 30d;
}
location = /baidu_verify_Mrj1Pt3L86.html {
root /Data/PE/yohobuy_pc/assets;
expires 7d;
}
location /_dead/ {
root /Data/PE/yohobuy_pc/dead/;
expires 7d;
}
location /sitemap_pc/ {
root /Data/PE/;
}
location ^~ /chanpin/ {
set $self_remote_addr $http_x_forwarded_for;
include vhosts/pc/cache.conf;
proxy_ignore_headers "Cache-Control" "Expires" "Vary";
include vhosts/pc/node-proxy.conf;
}
}
server
{
listen 80;
server_name yohobuy.com huodong.yohobuy.com ;
location / {
return 301 http://www.yohobuy.com$request_uri;
}
}
server
{
listen 80;
server_name api.open.yohobuy.com service.api.yohobuy.com;
location / {
return 404;
}
}
include vhosts/gourl.yohobuy.com.conf;
... ...
server
{
listen 8088;
#server_name localhost;
root /Data/PE/yohobuy_pc/yohobuy/www.yohobuy.com/public;
access_log /Data/logs/nginx/yohobuy-node/access_pc_spider.yohobuy.com.log fenxi;
error_log /Data/logs/nginx/yohobuy-node/error_pc_spider.yohobuy.com.log warn;
location / {
set $self_remote_addr $proxy_add_x_forwarded_for;
proxy_cache cache_one_spider;
proxy_cache_valid 200 6d;
proxy_cache_revalidate on;
proxy_cache_min_uses 1;
proxy_cache_lock on;
proxy_cache_key $host$uri;
add_header X-Cache-Status $upstream_cache_status;
proxy_ignore_headers "Set-Cookie" "Cache-Control" "Expires" "Vary";
proxy_hide_header Cache-Control;
proxy_hide_header Set-Cookie;
proxy_hide_header Pragma;
limit_req zone=limit_per_url_1000 burst=1000;
include vhosts/pc/node-proxy.conf;
}
}
\ No newline at end of file
... ...
####################################################
### this is for m.yohobuy.com
#####################################################
server {
listen 80;
server_name m.yohobuy.com *.m.yohobuy.com;
root /Data/node/yohobuywap-node/current/yohobuywap-node/public/static;
access_log /Data/logs/nginx/access_wap.yohobuy.com.log fenxi;
error_log /Data/logs/nginx/error_wap.yohobuy.com.log warn;
error_page 503 /503.html;
if ($http_user_agent ~* "Scrapy") {
return 403;
}
######force https######
set $rewite 0;
if ($http_x_client_proto = 'http') {
set $rewite 1;
}
if ($http_x_forwarded_proto = 'http') {
set $rewite 1;
}
if ($rewite = 1) {
return 301 https://$host$request_uri ;
}
location ^~ /activity/vip-day {
return 301 http://m.yohobuy.com;
}
# nginx status check
location = /status_check {
default_type text/html;
return 200 'server is ok!';
}
location /sitemap_h5/ {
root /Data/PE/;
}
location ~* .(txt)$ {
root /Data/node/yohobuywap-node/current/yohobuywap-node/public/static;
}
#cache config
include vhosts/wap/cache.conf;
#301 and idc
include vhosts/wap/301.conf;
#app
include vhosts/wap/app.conf;
#static
include vhosts/wap/static.conf;
#locations
include vhosts/wap/locations.conf;
location / {
#proxy
include vhosts/wap/node-proxy.conf;
}
}
####################################################
### this is for yohobuy live page and guang rss only for http
#####################################################
server {
listen 80;
server_name live.m.yohobuy.com http.m.yohobuy.com;
access_log /Data/logs/nginx/access_wap.yohobuy.com.log fenxi;
error_log /Data/logs/nginx/error_wap.yohobuy.com.log warn;
#cache config
include vhosts/wap/cache.conf;
location / {
#proxy
include vhosts/wap/node-proxy.conf;
}
}
... ...
server{
listen 80;
server_name admin.global.yohobuy.com;
access_log /Data/logs/nginx/access_yohobuy_global_bs.log fenxi;
location = /status_check {
default_type text/html;
return 200 'admin.global.yohobuy.com server is ok!';
}
location / {
allow 218.94.75.50;
allow 218.94.75.58;
allow 218.94.77.166;
allow 106.38.39.122;
allow 106.38.39.123;
allow 192.168.0.0/16;
allow 10.66.0.0/16;
deny all;
proxy_redirect off;
proxy_pass http://10.66.5.17:8080;
proxy_set_header Host $host;
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 ~* \.(ico|woff)$ {
root /Data/PE/yoho-global-bs/Websites/public;
expires 7d;
}
location = /crossdomain.xml {
expires 7d;
}
error_page 500 502 503 504 /50x.html;
location = /404.html {
root /Data/local/nginx-1.8.0/html/;
}
location = /50x.html {
root /Data/local/nginx-1.8.0/html/;
}
}
server{
listen 80;
server_name service.api.global.yohobuy.com;
access_log /Data/logs/nginx/access_yohobuy_global_bs.log fenxi;
location / {
proxy_redirect off;
proxy_pass http://globalbs;
proxy_connect_timeout 300;
proxy_read_timeout 300;
proxy_send_timeout 300;
proxy_set_header Host $host;
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 ~* \.(ico|woff)$ {
expires 7d;
}
location = /crossdomain.xml {
expires 7d;
}
error_page 500 502 503 504 /50x.html;
location = /404.html {
root /Data/local/nginx-1.8.0/html/;
}
location = /50x.html {
root /Data/local/nginx-1.8.0/html/;
}
}
server{
listen 80;
server_name api-global.yohobuy.com;
if ($request_method !~* GET|POST) {
return 200;
}
access_log /Data/logs/nginx/access_yohobuy_global_bs.log fenxi;
################## 临时使用,NGINX直接返回模拟的数据###########################
location = /order/api/v1/cart/getCartGoodList {
default_type application/json;
return 200 '{"code":"200","message":"cart list","data":{"global_cart_data":{"shopping_cart_data":{"shopping_key":"0","order_amount":0,"goods_count":0,"selected_goods_count":0,"str_order_amount":"¥0","str_tariff_amount":"¥0.00","tariff_select":"Y","promotion_formula":"总计¥0=商品金额¥0","promotion_formula_list":{"promotion":"商品金额","promotion_amount":"¥0"}},"goods_list":[],"sold_out_goods_list":[]}},"md5":"","t":{"i":0.0012209415435791,"e":0.0046169757843018,"t":0.0058379173278809},"s":"N"}';
}
location = /order/api/v1/cart/getCartGoodCount {
default_type application/json;
return 200 '{"code":"200","message":"cart count","data":{"uid":"0","shopping_key":"","cart_goods_count":0},"md5":"","t":{"i":0.001276969909668,"e":0.0031371116638184,"t":0.0044140815734863},"s":"N"}';
}
location = /order/api/v1/detail/getcount {
default_type application/json;
return 200 '{"code":"200","message":"order count","data":{"hasOrder":"N","collect_count":0,"successOrder":0,"cancelOrder":0,"tradingOrder":0},"md5":"","t":{"i":0.0010910034179688,"e":0.0036270618438721,"t":0.0047180652618408},"s":"N"}';
}
location = /order/api/v1/detail/getlist {
default_type application/json;
return 200 '{"code":200,"data":{"total":"0","page_total":0,"page":1,"order_list":[]},"md5":"","message":"操作成功"}';
}
location = /phpproxy/order/api/v1/detail/getlist {
default_type application/json;
return 200 '{"code":"200","message":"order list","data":{"order_list":[],"page_total":0,"page":1,"total":"0"},"md5":"","t":{"i":0.0010490417480469,"e":0.030877828598022,"t":0.031926870346069},"s":"N"}';
}
location = /order/api/v1/collect/getCollectList {
default_type application/json;
return 200 '{"code":"200","message":"collect product list","data":{"total":0,"page":1,"page_total":0,"product_list":[]},"md5":"","t":{"i":0.0010011196136475,"e":0.0028970241546631,"t":0.0038981437683105},"s":"N"}';
}
location = /order/api/v1/detail/getReasonForCancelOrder {
default_type application/json;
return 200 '{"code":"200","message":"order cancel reason list","data":[{"id":1,"reason":"支付不成功"},{"id":2,"reason":"现在不想购买"},{"id":3,"reason":"订单价格有问题"},{"id":4,"reason":"修改订单信息"},{"id":5,"reason":"错误或重复下单"},{"id":6,"reason":"商品价格较贵"},{"id":7,"reason":"运费较高"},{"id":8,"reason":"其他"}],"md5":"","t":{"i":0.0015950202941895,"e":0.00031089782714844,"t":0.0019059181213379},"s":"N"}';
}
location / {
proxy_redirect off;
proxy_pass http://globalbs;
proxy_connect_timeout 300;
proxy_read_timeout 300;
proxy_send_timeout 300;
proxy_set_header Host $host;
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";
}
###########begin java##############
location ^~ /order/api/v1/address/infoList {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/address/infoList;
proxy_set_header Host $host;
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 ^~ /order/api/v1/address/add {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/address/add;
proxy_set_header Host $host;
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 ^~ /order/api/v1/address/edit {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/address/edit;
proxy_set_header Host $host;
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";
}
########change by jian.chen 10/1/2017 yuankai ##################
location ^~ /product/api/v2/detail/getlist {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/product/api/v2/detail/getlist;
proxy_set_header Host $host;
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";
}
#########change by xiu.chun 24/05/2017 yuankai####################
location ^~ /order/api/v1/confirm/preview {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/confirm/preview;
proxy_set_header Host $host;
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 ^~ /order/api/v1/detail/getlist{
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/detail/getlist;
proxy_set_header Host $host;
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 ^~ /order/api/v1/address/setDefault {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/address/setDefault;
proxy_set_header Host $host;
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 ^~ /order/api/v1/address/delete {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/address/delete;
proxy_set_header Host $host;
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 = /order/api/v1/detail/get {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/detail/get;
proxy_set_header Host $host;
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 ^~ /order/api/v1/detail/editAddress {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/detail/editAddress;
proxy_set_header Host $host;
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 ^~ /order/api/v1/detail/cancel {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/detail/cancel;
proxy_set_header Host $host;
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 ^~ /order/api/v1/detail/del {
proxy_redirect off;
proxy_pass http://globalbuyapi/globalbuy/order/api/v1/detail/del;
proxy_set_header Host $host;
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 ~ /phpproxy {
proxy_pass http://globalbs;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
############end java###############
location ~* \.(ico|woff)$ {
expires 7d;
}
location = /crossdomain.xml {
expires 7d;
}
error_page 500 502 503 504 /50x.html;
location = /404.html {
root /Data/local/nginx-1.8.0/html/;
}
# location = /50x.html {
# root /Data/local/nginx-1.8.0/html/;
# }
location = /50x.html {
default_type application/json;
return 200 '{"message": "活动太火爆了,请稍后重试","code": 500}';
}
}
##############443端口合并至elb处理####################
#server{
# listen 443 ssl;
# server_name api-global.yohobuy.com;
# access_log /Data/logs/nginx/access_yohobuy_global_bs_https.log fenxi;
# error_log /Data/logs/nginx/error_yohobuy_global_bs_https.log;
## ssl config
# ssl_certificate /Data/local/nginx-1.8.0/conf/ssl/global_ssl/global.pem;
# ssl_certificate_key /Data/local/nginx-1.8.0/conf/ssl/global_ssl/server.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers TLS_RSA_WITH_AES_128_CBC_SHA:TLS_RSA_WITH_AES_256_CBC_SHA:TLS_RSA_WITH_AES_128_CBC_SHA256:TLS_RSA_WITH_AES_256_CBC_SHA256:HIGH:!aNULL:!MD5:!ECDHE:!EDH:!DHE:!ECDH:!CAMELLIA:!GCM;
# ssl_prefer_server_ciphers on;
# location / {
# proxy_redirect off;
# proxy_pass http://globalbs;
# proxy_set_header Host $host;
# 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";
# }
###########begin java##############
# location ^~ /order/api/v1/address/infoList {
# proxy_redirect off;
# proxy_pass http://globalbuyapi/globalbuy/order/api/v1/address/infoList;
# proxy_set_header Host $host;
# 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 ^~ /order/api/v1/address/add {
# proxy_redirect off;
# proxy_pass http://globalbuyapi/globalbuy/order/api/v1/address/add;
# proxy_set_header Host $host;
# 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 ^~ /order/api/v1/address/edit {
# proxy_redirect off;
# proxy_pass http://globalbuyapi/globalbuy/order/api/v1/address/edit;
# proxy_set_header Host $host;
# 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";
# }
############end java###############
# location ~* \.(ico|woff)$ {
# expires 7d;
# }
# location = /crossdomain.xml {
# expires 7d;
# }
# error_page 500 502 503 504 /50x.html;
# location = /404.html {
# root /Data/local/nginx-1.8.0/html/;
# }
# location = /50x.html {
# root /Data/local/nginx-1.8.0/html/;
# }
#}
... ...