简体   繁体   English

在容器中以动态配置将Nginx作为反向代理运行

[英]Running nginx in a container as reverse proxy with dynamic configuration

I'm trying to setup nginx as a reverse proxy in a container for my containers (Docker Swarm) and static sites which are being hosted on Google Cloud Platform & Netlify 我正在尝试将nginx设置为容器(Docker Swarm)和托管在Google Cloud Platform&Netlify上的静态站点的容器中的反向代理

I'm actually able to run nginx in containers, but I'm really worried about the configurations. 我实际上可以在容器中运行nginx,但是我真的很担心配置。

  1. How will I update my site configurations in nginx to all containers (add / remove location)? 如何将nginx中的站点配置更新为所有容器(添加/删除位置)?
  2. Is attaching a disk is the best option to store logs? 附加磁盘是存储日志的最佳选择吗?
  3. Is there any fault in my architecture? 我的体系结构是否有故障?

建筑

If image isn't working, please use this link - https://s1.postimg.org/1tv4hka3zz/profitto-architecture_1.png 如果图片无效,请使用此链接-https://s1.postimg.org/1tv4hka3zz/profitto-architecture_1.png

Hej Sanjay. Hej Sanjay。

Have a look at: 看一下:

https://github.com/jwilder/nginx-proxy https://github.com/jwilder/nginx-proxy

https://traefik.io/ https://traefik.io/

The first one is a modified Nginx Reverse Proxy by J.Wilder. 第一个是J.Wilder修改后的Nginx反向代理。 The Second one is a new and native Reverse Proxy created specially for such use cases. 第二个是专门为此类用例创建的新的本地反向代理。

Both are able to listen to the docker.socks and dnynamicly add new containers to the reverse-proxy backend. 两者都能够监听docker.socks并动态添加新容器到反向代理后端。

Regarding your Architecture: Why not running the Reverse-Proxy Containers inside the Swarm Cluster? 关于您的体系结构:为什么不在Swarm集群中运行反向代理容器?

Related to logging, have a Look at the Docker Log-Drivers. 与日志记录相关,请查看Docker Log-Drivers。 You can collect the Logs of all Containers with eg. 您可以使用例如收集所有容器的日志。 fluentd or splunk. 流利或sp弹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM