Fork me on GitHub
瞬间的惊奇真是种确幸,每种确幸都是支玄妙的俳句。吊桥抬起,退回到内心幽静的花园,邂逅的还是那种熟悉的冷冷清清又轰轰烈烈的美妙质感。这真令人欢喜。

nginx proxy文件编写总结

upstream.conf

upstream api {

server 192.168.10.10:8080;
server 192.168.10.20:8080;
}

server{
listen 443 ssl;
server_name gui.sensen.com;

location / {
proxy_pass http://api;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log /var/log/nginx/sensen/acccess.log json;

}

 

rewrite.conf

server{
listen 443 ssl;
server_name doc.luoluo.com;

location / {
proxy_pass http://192.168.10.10:8080;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
rewrite ^/(.*)$ /api/$1 break;
}

location /api {
proxy_pass http://192.168.10.20:8080;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log /var/log/nginx/sensen/doc_acccess.log main;
}

 

producter.conf

server{
listen 443 ssl;
server_name producter.luoluo.com;

location / {
proxy_pass http://192.168.10.10:9091;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
}

location /pay {
proxy_pass http://192.168.10.20:8080;
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_set_header X-Forwarded-Proto $scheme;
rewrite ^/pay/(.*)$ /rest/payment/$1 break;
}


location /rest/service/ {
proxy_pass http://192.168.10.30:8080;
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_set_header X-Forwarded-Proto $scheme;
}
access_log /var/log/nginx/producter/access.log json;

}

 

normal.conf

server{
listen 443 ssl;
server_name sn.luluo.com;

location / {
proxy_pass http://192.168.10.20:80;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
}
access_log /var/log/nginx/sensen/access.log json;

}

posted @ 2018-10-01 10:27  干嘛那么贪睡  阅读(347)  评论(0编辑  收藏  举报