1.拉取 nginx   docker pull nginx

2.创建 nginx 容器  

docker run -d --restart=always -v /home/czc/document/:/home/czc/document -v /home/czc/java/nginx/web/:/home/czc/java/nginx/web/ -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro -v /home/czc/java/nginx/nginx_conf/:/etc/nginx/conf.d -p 8000:80 -p:4433:443 --name=nginx  nginx

vue文件存放目录:/home/czc/java/nginx/web/

nginx 配置文件存放目录 /home/czc/java/nginx/nginx_conf/

3.nginx 配置文件

名称:xxx.conf

内容

upstream pc { 
    server 10.0.0.107:5000; //转发的地址1
} upstream api { 
    server 10.0.0.118:5719; //转发的地址2
} 


server { 
  listen 80; //80是监听http的地址 443是监听https的地址
  server_name 10.0.0.118; //访问的地址 或者设置域名
  location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    root /home/czc/java/nginx/web/; //vue存放的路径
    index index.html; 
  } 

  location /v1{//匹配的地址
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_pass http://pc; //转发的路径
  }

   location /superzig2.0 {//匹配的地址
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_pass http://api; //转发的路径
  }  location /picture {
   alias C:\czc\5701\picture;
   autoindex on;
   }
}