CodeArena

Docker安装Nginx

2023-04-13
Docker
最后更新:2024-05-23
1分钟
69字

1、docker安装Nginx命令

Terminal window
1
docker run --restart always --name Nginx -d -p 80:80 nginx

2、Nginx容器目录映射到服务器/本地

Terminal window
1
docker container cp Nginx:/etc/nginx/nginx.conf /data/nginx/conf
2
3
docker container cp Nginx:/etc/nginx/conf.d/default.conf /data/nginx/conf/conf.d
4
5
docker container cp Nginx:/usr/share/nginx/html/index.html /data/nginx/html
6
7
docker run --name Nginx -p 80:80 \
8
-v /data/nginx/logs:/var/log/nginx \
9
-v /data/nginx/html:/usr/share/nginx/html \
10
-v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
11
-v /data/nginx/conf/conf.d:/etc/nginx/conf.d \
12
-v /data/nginx/ssl:/etc/nginx/ssl/ \
13
--privileged=true -d --restart=always nginx
本文标题:Docker安装Nginx
文章作者:Echoidf
发布时间:2023-04-13
感谢大佬送来的咖啡☕
alipayQRCode
wechatQRCode