Authored by 梁志锋

nginx修改备份

1 1
2 #old idc 2 #old idc
3 -  
4 - # location = /erp2goods {  
5 - # proxy_redirect off;  
6 - # proxy_pass http://yohobuy-old-www;  
7 - # proxy_set_header Host $host;  
8 - # proxy_set_header X-Real-IP $remote_addr;  
9 - # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
10 - # proxy_set_header Accept-Encoding "gzip";  
11 - # }  
12 -  
13 location = /passport/auth/signin { 3 location = /passport/auth/signin {
14 proxy_redirect off; 4 proxy_redirect off;
15 proxy_pass http://yohobuy-old-www; 5 proxy_pass http://yohobuy-old-www;
@@ -30,4 +30,31 @@ @@ -30,4 +30,31 @@
30 proxy_set_header X-Real-IP $remote_addr; 30 proxy_set_header X-Real-IP $remote_addr;
31 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 31 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
32 proxy_set_header Accept-Encoding "gzip"; 32 proxy_set_header Accept-Encoding "gzip";
33 - }  
  33 + }
  34 +
  35 + location ^~ /common/passport {
  36 + proxy_redirect off;
  37 + proxy_pass http://yohobuy-pc;
  38 + proxy_set_header Host $host;
  39 + proxy_set_header X-Real-IP $remote_addr;
  40 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  41 + proxy_set_header Accept-Encoding "gzip";
  42 + }
  43 +
  44 + location ^~ /Passport/session/index {
  45 + proxy_redirect off;
  46 + proxy_pass http://yohobuy-old-www;
  47 + proxy_set_header Host $host;
  48 + proxy_set_header X-Real-IP $remote_addr;
  49 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  50 + proxy_set_header Accept-Encoding "gzip";
  51 + }
  52 +
  53 + location ^~ /home/address/area {
  54 + proxy_redirect off;
  55 + proxy_pass http://yohobuy-pc;
  56 + proxy_set_header Host $host;
  57 + proxy_set_header X-Real-IP $remote_addr;
  58 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  59 + proxy_set_header Accept-Encoding "gzip";
  60 + }
@@ -19,16 +19,7 @@ server @@ -19,16 +19,7 @@ server
19 # node 19 # node
20 include vhosts/location/yohobuypc_node.conf; 20 include vhosts/location/yohobuypc_node.conf;
21 21
22 -  
23 - location = /index.html {  
24 - return 301 http://www.yohobuy.com/;  
25 - }  
26 -  
27 - location ^~ /resource/getbanner {  
28 - rewrite /resource/getbanner(.*)$ https://www.yohobuy.com/common/getbanner$1 permanent;  
29 - }  
30 -  
31 - location ~* /special_(\d+)_(.*)\.html$ { 22 + location ~* /special_(\d+)_(.*)\.html$ {
32 proxy_redirect off; 23 proxy_redirect off;
33 proxy_pass http://yohobuy-old-www; 24 proxy_pass http://yohobuy-old-www;
34 proxy_set_header Host $host; 25 proxy_set_header Host $host;
@@ -46,8 +37,25 @@ server @@ -46,8 +37,25 @@ server
46 proxy_set_header Accept-Encoding "gzip"; 37 proxy_set_header Accept-Encoding "gzip";
47 } 38 }
48 39
  40 + location ^~ /home/returns {
  41 + proxy_redirect off;
  42 + proxy_pass http://yohobuy-pc;
  43 + proxy_set_header Host $host;
  44 + proxy_set_header X-Real-IP $remote_addr;
  45 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  46 + proxy_set_header Accept-Encoding "gzip";
  47 + }
  48 +
  49 + location = /index.html {
  50 + return 301 http://www.yohobuy.com/;
  51 + }
  52 +
  53 + location ^~ /resource/getbanner {
  54 + rewrite /resource/getbanner(.*)$ https://www.yohobuy.com/common/getbanner$1 permanent;
  55 + }
  56 +
49 #https flag, 1 means HTTPS, 0 means HTTP 57 #https flag, 1 means HTTPS, 0 means HTTP
50 - set $httpsFlag 1; 58 + set $httpsFlag 0;
51 59
52 location / { 60 location / {
53 if ($httpsFlag = 1) { 61 if ($httpsFlag = 1) {
@@ -66,7 +74,7 @@ server @@ -66,7 +74,7 @@ server
66 74
67 server 75 server
68 { 76 {
69 - listen 80; 77 + listen 80;
70 listen 443 ssl; 78 listen 443 ssl;
71 ssl_certificate /Data/local/nginx-1.8.0/conf/ssl/pc/server.pem; 79 ssl_certificate /Data/local/nginx-1.8.0/conf/ssl/pc/server.pem;
72 ssl_certificate_key /Data/local/nginx-1.8.0/conf/ssl/pc/server.key; 80 ssl_certificate_key /Data/local/nginx-1.8.0/conf/ssl/pc/server.key;
@@ -122,8 +130,12 @@ server @@ -122,8 +130,12 @@ server
122 return 301 http://$host$request_uri; 130 return 301 http://$host$request_uri;
123 } 131 }
124 132
  133 + location ^~ /home/returns {
  134 + return 301 http://$host$request_uri;
  135 + }
  136 +
125 location = /index.html { 137 location = /index.html {
126 - return 301 http://www.yohobuy.com/; 138 + return 301 http://www.yohobuy.com/;
127 } 139 }
128 140
129 location ^~ /resource/getbanner { 141 location ^~ /resource/getbanner {
@@ -131,7 +143,7 @@ server @@ -131,7 +143,7 @@ server
131 } 143 }
132 144
133 #https flag, 1 means HTTPS, 0 means HTTP 145 #https flag, 1 means HTTPS, 0 means HTTP
134 - set $httpsFlag 1; 146 + set $httpsFlag 0;
135 147
136 location / { 148 location / {
137 if ($httpsFlag = 0) { 149 if ($httpsFlag = 0) {
@@ -234,21 +246,22 @@ server @@ -234,21 +246,22 @@ server
234 include vhosts/location/yohobuypc_static.conf; 246 include vhosts/location/yohobuypc_static.conf;
235 } 247 }
236 248
237 -#server  
238 -#{  
239 -# listen 80;  
240 -# listen 443 ssl;  
241 -#  
242 -# server_name yohobuy.com;  
243 -# ssl_certificate /Data/local/nginx-1.8.0/conf/ssl/pc/server.pem;  
244 -# ssl_certificate_key /Data/local/nginx-1.8.0/conf/ssl/pc/server.key;  
245 -#  
246 -# # access_log /Data/logs/nginx/access_pc.yohobuy.com.log fenxi;  
247 -# error_log /Data/logs/error_pc.yohobuy.com.log warn;  
248 -# location = / {  
249 -# return 301 https://www.yohobuy.com/;  
250 -# }  
251 -#} 249 +server
  250 +{
  251 + listen 80;
  252 + #listen 443 ssl;
  253 +
  254 + server_name yohobuy.com;
  255 + #ssl_certificate /Data/local/nginx-1.8.0/conf/ssl/pc/server.pem;
  256 + #ssl_certificate_key /Data/local/nginx-1.8.0/conf/ssl/pc/server.key;
  257 +
  258 + # access_log /Data/logs/nginx/access_pc.yohobuy.com.log fenxi;
  259 + error_log /Data/logs/error_pc.yohobuy.com.log warn;
  260 + location = / {
  261 + return 301 http://www.yohobuy.com/;
  262 + }
  263 +}
  264 +
252 265
253 server 266 server
254 { 267 {
@@ -268,6 +281,7 @@ server @@ -268,6 +281,7 @@ server
268 proxy_set_header X-Real-IP $remote_addr; 281 proxy_set_header X-Real-IP $remote_addr;
269 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 282 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
270 proxy_set_header Accept-Encoding "gzip"; 283 proxy_set_header Accept-Encoding "gzip";
  284 + proxy_set_header http_referer $http_referer;
271 } 285 }
272 } 286 }
273 287
@@ -283,6 +297,7 @@ server @@ -283,6 +297,7 @@ server
283 proxy_set_header X-Real-IP $remote_addr; 297 proxy_set_header X-Real-IP $remote_addr;
284 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 298 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
285 proxy_set_header Accept-Encoding "gzip"; 299 proxy_set_header Accept-Encoding "gzip";
  300 + proxy_set_header http_referer $http_referer;
286 } 301 }
287 302
288 } 303 }