更新上游服务器时,重新启动Nginx容器 [英] restart nginx container when upstream servers is updated
本文介绍了更新上游服务器时,重新启动Nginx容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在docker容器中运行的nginx中添加/删除服务器
I want to add/remove servers in my nginx running inside a docker container
我在Dockerfile中使用ADD命令将我的nginx.conf添加到/etc/nginx目录中.
I use ADD command in Dockerfile to add my nginx.conf to /etc/nginx dir.
# Copy a configuration file from the current directory
ADD nginx.conf /etc/nginx/
然后在我正在运行的nginx容器中有一个类似conf的
then in my running nginx container that have a conf like this
# List of application servers
upstream app_servers {
server 172.17.0.91:9000;
server 172.17.0.92:9000;
server 172.17.0.93:9000;
}
如何重新启动我的nginx以使已编辑的nginx.conf生效?
how do restart my nginx to take effect of the edited nginx.conf?
先谢谢您!
推荐答案
要重新加载NGINX配置,请运行命令
to reload the NGINX configuration run the command
docker kill -s HUP container_name
https://blog .docker.com/2015/04/tips-for-deploying-nginx-official-image-with-docker/
这篇关于更新上游服务器时,重新启动Nginx容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文