一:將前端打包
二:使用SCP上傳至服務器對應的目錄
# scp -r dist root@101.111.111.11:/data/nginx/nginx/web/html
【如有錯誤:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:qMXxRZJaediwnkmkHTpsKA9VhXXYYmCrgOwIbUA67nM.
Please contact your system administrator.
Add correct host key in C:\\Users\\Administrator.MicroWin10-1848/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\Administrator.MicroWin10-1848/.ssh/known_hosts:1
ECDSA host key for 101.200.154.43 has changed and you have requested strict checking.
Host key verification failed.
lost connection
解決刪除C:\Users\Administrator.MicroWin10-1848\.ssh下面的文件即可】
三:nginx配置
user root;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
 worker_connections 1024;
}
http {
 include /etc/nginx/mime.types;
 default_type application/octet-stream;
 log_format main '$remote_addr - $remote_user [$time_local] "$request" '
 '$status $body_bytes_sent "$http_referer" '
 '"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
 sendfile on;
 #tcp_nopush on;
keepalive_timeout 65;
#gzip on;
#include /etc/nginx/conf.d/*.conf;
 server {
 listen 8000;
 server_name web;
 root /usr/share/nginx/html;
location / {
}
 location ^~/api {
 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_buffering off;
 rewrite ^/api/(.*)$ /$1 break;
 proxy_pass http://cio-blade-boot:90;
 }
 }
}
四:docker-compose 配置:
version: '3'
services:
 cio-nginx:
 image: nginx:stable-alpine-perl
 hostname: "cio-nginx"
 environment:
 - TZ=Asia/Shanghai
 ports:
 - 8000:8000
 privileged: true
 volumes:
 - ./nginx/web/nginx.conf:/etc/nginx/nginx.conf
 - ./nginx/web/html:/usr/share/nginx/html
 restart: always
 networks:
 - cio_network
 cio-blade-boot:
 hostname: "cio-blade-boot"
 image: "harbor.zxxxxxxxxxxxxg.com:81/blade/blade-api:2.5.0.release"
 environment:
 - TZ=Asia/Shanghai
 ports:
 - 90:90
 privileged: true
 restart: always
 networks:
 - cio_network
networks: 
 cio_network:
 #driver: bridge
 external: true
注意:
90為后端服務端口
8000為前端訪問端口
同時執行:
【使用docker-compose命令需要創建數據卷:
docker volume create mysql_data
創建一個docker網絡,目的是以后i再有想和這個互通的,或者是想不多配置一個nginx容器的,就可以加入到這個網絡:
docker network create cio_network】
運行docker-compose啟動
