https://github.com/stilleshan/nginx
docker 快速部署 nginx 环境,适用于 HTML 页面站点,简单 Web 测试环境以及反向代理 docker 容器等需求.
https://github.com/stilleshan/nginx
docker-nginx nginx nginx-docker
Last synced: 5 months ago
JSON representation
docker 快速部署 nginx 环境,适用于 HTML 页面站点,简单 Web 测试环境以及反向代理 docker 容器等需求.
- Host: GitHub
- URL: https://github.com/stilleshan/nginx
- Owner: stilleshan
- Created: 2020-03-27T05:41:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-18T13:54:33.000Z (over 4 years ago)
- Last Synced: 2025-05-12T23:36:21.606Z (7 months ago)
- Topics: docker-nginx, nginx, nginx-docker
- Language: HTML
- Homepage:
- Size: 6.84 KB
- Stars: 10
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nginx
docker 快速部署 nginx 环境,适用于 HTML 页面站点,简单 Web 测试环境以及反向代理 docker 容器等需求.
## 部署
### docker
在 root 目录下 git clone 本仓库用来挂载相关配置文件
```shell
cd ~
git clone https://github.com/stilleshan/nginx.git
```
启动 nginx 容器
```shell
docker run -d --name=nginx --restart=always \
--network host \
-v ~/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v ~/nginx/vhost:/etc/nginx/conf.d/vhost \
-v ~/nginx/ssl:/etc/nginx/ssl \
-v ~/nginx/html:/usr/share/nginx/html \
nginx
```
### docker compose
```shell
cd ~
git clone https://github.com/stilleshan/nginx.git
cd nginx
docker-compose up -d
```
## 说明
`~/nginx/conf` 用于存放`nginx 主配置`文件
> conf 目录下为官方 nginx.conf 配置文件,已新增 include vhost 目录以方便挂载多站点配置文件.
`~/nginx/vhost` 用于存放`各站点 conf 配置`文件
> vhost 目录中已有常用的 conf 样本,参考修改域名和证书路径.
`~/nginx/ssl` 用于存放`证书`文件
> ssl 目录有样本 conf 所需证书文件,如需删除请连同 conf 样本一起删除,避免 nginx 报错.
`~/nginx/html` 用于存放`网页`文件
> html 目录为站点根目录,自行创建子目录存放网页以用来部署多个站点.
## 链接
[Docker 打造支持快速部署和迁移的 Nginx 环境](https://www.ioiox.com/archives/91.html)