version: '3.7'
services:
nginx-proxy:
image: nginx
container_name: nginx-proxy
restart: always
ports:
- 80:80
- 443:443
volumes:
- ./nginx-proxy/certs:/etc/nginx/certs:ro
- ./nginx-proxy/conf.d:/etc/nginx/conf.d # mount the local config directory
nginx1:
image: nginx
container_name: nginx1
restart: always
environment:
- VIRTUAL_HOST=swjnxyf.cc # change this to your first domain name
volumes:
- ./nginx1/html:/usr/share/nginx/html # mount the local html directory
nginx2:
image: nginx
container_name: nginx2
restart: always
environment:
- VIRTUAL_HOST=swjnxyf.cn # change this to your second domain name
volumes:
- ./nginx2/html:/usr/share/nginx/html # mount the local html directory
docker-compose up -d 就会自动创建目录了。
[root@localhost server]# tree
.
├── docker-compose.yml
├── nginx1
│ └── html
├── nginx2
│ └── html
└── nginx-proxy
├── certs
└── conf.d
当然。html文件夹的静态网页需要自行创建。
docker exec -it nginx-proxy /bin/sh
# nginx -t //检测无误就这样
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# nginx -s reload
2023/06/17 15:00:53 [notice] 36#36: signal process started
由于本人已经修改了win10de hosts文件,解析了所需要的域名到虚拟机的IP,所以才能实验顺利。
访问https://swjnxyf.cn/ 就OK了。提示证书风险,忽略即可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」