Skip to content

Commit

Permalink
测试nginx 进行 rabbitmq 5672代理
Browse files Browse the repository at this point in the history
  • Loading branch information
supermy committed Oct 12, 2016
1 parent 4572f73 commit 1732342
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
3 changes: 3 additions & 0 deletions BusinessScene/web-mq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ curl -i -X POST -H "Content-Type:application/json" -d '{"touser":"oio3NwbS8BVVWl
提取日志信息push 到MQ;url 作为route key。

##变更日志
###2016-10-12
* 测试nginx 进行 rabbitmq 5672代理

###2016-09-13
* 初始化项目

Expand Down
4 changes: 3 additions & 1 deletion BusinessScene/web-mq/conf/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,6 @@ http {
# }
#}

}
}

include /usr/local/openresty/nginx/conf/stream.conf;
33 changes: 33 additions & 0 deletions BusinessScene/web-mq/conf/nginx/stream.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
stream {
upstream backend {
hash $remote_addr consistent;

#server backend1.example.com:12345 weight=5;
server mq:5672 max_fails=3 fail_timeout=30s;
server unix:/tmp/backend3;
}

#upstream dns {
# server 192.168.0.1:53535;
# server dns.example.com:53;
#}

server {
listen 5672;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass backend;
}

#server {
# listen 127.0.0.1:53 udp;
# proxy_responses 1;
# proxy_timeout 20s;
# proxy_pass dns;
#}

server {
listen [::1]:12345;
proxy_pass unix:/tmp/stream.socket;
}
}
9 changes: 6 additions & 3 deletions BusinessScene/web-mq/fig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
#启动web
web:
image: supermy/ap-waf
# links:
# - myredis:redis
links:
- mq
ports:
- "80:80"
- "5672:5672"

volumes_from:
- data

Expand All @@ -16,6 +18,7 @@ data:
command: /bin/true
volumes:
- ./conf/nginx/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf
- ./conf/nginx/stream.conf:/usr/local/openresty/nginx/conf/stream.conf
- ./conf/nginx/http.d/:/usr/local/openresty/nginx/conf/http.d/
- ./conf/nginx/server.d/:/usr/local/openresty/nginx/conf/server.d/
- ./conf/lua.app/:/usr/local/openresty/lua.app/
Expand All @@ -25,7 +28,7 @@ data:
mq:
image: supermy/ap-rabbitmq
ports:
- "5672:5672"
# - "5672:5672"
- "15672:15672"

#redis:
Expand Down

0 comments on commit 1732342

Please sign in to comment.