nginx.test.yohobuy.conf
4.03 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
server
{
listen 80;
server_name buy.test.yoho.cn *.test.yoho.cn;
#access_log /Data/logs/access.buy.test.yoho.cn.log combined;
error_log /Data/logs/error.buy.test.yoho.cn.log warn;
root /Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public;
#match ip
deny 192.168.1.1;
allow 218.94.75.50;
allow 218.94.75.58;
allow 123.56.138.21;
allow 106.39.86.226;
allow 172.16.0.0/16;
deny all;
# 子域名
if ($host = "sale.test.yoho.cn" ) {
proxy_redirect off;
proxy_pass http://61.155.222.162;
proxy_set_header Host cuxiao.m.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";
}
if ($host = "cuxiao.test.yoho.cn" ) {
proxy_redirect off;
proxy_pass http://101.201.176.121;
proxy_set_header Host cuxiao.m.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 =/signin.html {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.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 /passport/auth {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.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 /passport/signin {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.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 /home {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.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 /cart {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.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 ~* \.html$ {
root /Data/code/git/yohobuy/assets;
if (!-f $request_filename){
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
}
expires 3m;
}
location ~* \.(ico|woff|svg|eot|ttf|otf)$ {
expires 30d;
}
location =/crossdomain.xml {
expires 30d;
}
location =/sitemap.xml {
expires 1d;
}
location=/robots.txt {
expires 1d;
}
location / {
proxy_redirect off;
proxy_pass http://yohobuy;
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";
}
}
server
{
listen 80;
server_name static.buy.test.yoho.cn;
#access_log /Data/logs/access.static.buy.test.yoho.cn.log combined;
#error_log /Data/logs/error.static.buy.test.yoho.cn.log warn;
root /Data/code/git/yohobuy/static;
location / {
log_not_found off;
access_log off;
expires 30d;
}
location ~* \.(svg|eot|ttf|woff|otf)$ {
add_header Access-Control-Allow-Origin *;
expires 30d;
}
}