博文目录
说明
Docker Hub Nginx
数据卷 | 数据卷印射在容器内的路径 |
---|
nginx.conf | /etc/nginx |
nginx.html | /usr/share/nginx/html |
nginx.log | /var/log/nginx |
容器内的路径 | 说明 |
---|
/etc/nginx/nginx.conf | 配置文件 |
/etc/nginx/conf.d | 配置目录 |
/usr/share/nginx/html | 静态目录 |
/var/log/nginx | 日志目录 |
命令
docker pull nginx
docker network create network
docker volume create nginx.html
docker volume create nginx.conf
docker volume create nginx.log
docker run -d --name nginx --network network -p 80:80 -e TZ=Asia/Shanghai -v nginx.conf:/etc/nginx -v nginx.html:/usr/share/nginx/html -v nginx.log:/var/log/nginx nginx:latest
docker logs nginx
docker logs -f nginx
docker logs --follow nginx
docker logs --tail 10 nginx
docker logs -f --tail 10 nginx
docker logs --since 10m nginx
docker exec -it nginx bash
exit
nginx -t
nginx -s reload
docker exec -it nginx nginx -t
docker exec -it nginx nginx -s reload
注意, 默认情况下, nginx.conf 内部没有 server 配置, 而是在 conf.d 下的 default.conf 内