docker for nginx(1.16.0)

Դ未知

ߣ老铁SEO

13

2019-10-14 18:26:26

docker创建nginx

docker for nginx(1.16.0)
 
1?创建nginx
docker run –name nginx \
-p 80:80 \
-m 2048m \
–net=host \
–privileged=true \
-v /home/work/nginx/html:/usr/share/nginx/html \
-v /home/work/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /home/work/nginx/logs:/var/log/nginx \
-d nginx:1.16.0
 
 
–restart=always \ 不要重启功能
使用主机模式
 
2?刷新nginx配置
docker exec -it nginx /usr/sbin/nginx -s reload
docker exec -it nginx /usr/sbin/nginx -s stop
 
3?nginx内部工作目录
etc/nginx/nginx.conf
/usr/lib/nginx
/usr/sbin/nginx
/usr/share/doc/nginx
/usr/share/nginx
/var/cache/nginx
/var/log/nginx
 
4?从镜像获的默认配置文件nginx.conf,这个配置文件跟官网的配置文件不一样
docker run –name tmp-nginx-container -d nginx
docker cp tmp-nginx-container:/etc/nginx/nginx.conf /host/path/nginx.conf
docker rm -f tmp-nginx-container

佭ϴý Ѷ Media8ý

在线客服

外链咨询

扫码加我微信

微信:juxia_com

返回顶部