docker-compose 启动nginx
时间: 2023-08-21 09:04:58 浏览: 243
docker-compose 一键启动服务端,史上最简单的内网穿透软件,部署简单,使用简单,传输稳定
要使用docker-compose启动nginx,你需要创建一个docker-compose.yml文件,并在其中指定nginx的相关配置。根据引用和引用的内容,你可以按照以下步骤进行操作:
1. 进入工作目录并创建docker-compose.yml文件:
```
cd /root/nginx
vim docker-compose.yml
```
2. 在docker-compose.yml文件中添加以下内容:
```
version: '3'
services:
nginx:
image: nginx
container_name: nginx
restart: always
ports:
- 80:80
volumes:
- ./config/nginx/:/etc/nginx
- ./data/html:/usr/share/nginx/html
- ./logs/:/var/log/nginx
```
3. 保存并退出docker-compose.yml文件。
4. 启动nginx容器:
```
docker-compose up -d
```
这样,你就可以使用docker-compose启动nginx容器了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [docker-compose部署Nginx](https://blog.csdn.net/qq_14999375/article/details/123427710)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [docker-compsoe启动nginx](https://blog.csdn.net/weixin_43458965/article/details/129339011)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文