edrp.cn的Blog

学习,需要交流,欢迎大家和我共同来学习C#,ASP.NET,MS SQL Server开发Web项目,欢迎大家和我交流

博客园 首页 新随笔 联系 订阅 管理

一:将前端打包

二:使用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启动

 

posted on 2020-04-17 23:24  edrp.cn  阅读(1401)  评论(0编辑  收藏  举报