feat(nginx): 添加 nginx 服务的 docker compose 配置
- 配置 nginx 容器镜像为最新版本 - 设置容器名称为 nginx 并启用自动重启 - 映射端口 80 和 443 到宿主机 - 添加四个卷挂载用于日志、静态文件、证书和配置文件 - 挂载核心 nginx.conf 配置文件到容器内
This commit is contained in:
parent
266bdd325c
commit
e446d1c692
|
|
@ -0,0 +1,17 @@
|
|||
services:
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
container_name: nginx
|
||||
restart: always
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
# 完全按照你的原版物理路径映射
|
||||
- /opt/docker/nginx/logs:/etc/nginx/logs
|
||||
- /opt/docker/nginx/html:/etc/nginx/html
|
||||
- /opt/docker/nginx/cert:/etc/nginx/cert
|
||||
- /opt/docker/nginx/conf:/etc/nginx/conf
|
||||
|
||||
# 核心主配置文件(确保执行过刚才的拷贝,宿主机上有这个文件)
|
||||
- /opt/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
|
||||
Loading…
Reference in New Issue