1、环境
- 操作系统:Centos 7
- docker 版本:19.03.7
- docker-compose 版本:1.24.0
- 容器中Nginx 版本:1.17.9
2、目录结构
$ tree -L 2
.
├── conf.d
│ └── webui.conf
├── docker-compose.yml
├── Dockerfile
└── static
├── 50x.html
├── index.html
...
其中,conf.d
目录放置Nginx反向代理的配置文件,static
中为web的静态资源文件。
3、各个配置文件定义如下:
3.1 webui.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
#虚拟主机配置
server {
listen 80; #侦听80端口,并为默认服务, default_server只能有一个
server_name localhost; #服务域名,可以有多个, 用空格隔开
charset utf-8;
location / {
root /usr/share/nginx/html; #定义服务器的默认网站根目录位置
autoindex on;
access_log on;
index index.html index.htm; #定义index页面
}
location /api/v1