# dockerfile-yapi **Repository Path**: morningborn/dockerfile-yapi ## Basic Information - **Project Name**: dockerfile-yapi - **Description**: yapi docker部署,以及docker-compose文件 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-07 - **Last Updated**: 2021-12-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: yapi ## README # yapi部署 基于docker-compose进行部署 操作系统镜像版本:centos 7 nodejs版本:nodejs 8.15.1 默认安装yapi版本:yapi 1.10.2 # 安装启动执行顺序 ``` 1、yapi-mongo.yaml 启动关停命令: docker-compose -f yapi-mongo.yaml start docker-compose -f yapi-mongo.yaml up -d 2、yapi-first.yaml 启动关停命令: docker-compose -f yapi-first.yaml start docker-compose -f yapi-first.yaml up -d 安装完成之后,关闭yapi-first.yaml 3、yapi-second.yaml 启动关停命令: docker-compose -f yapi-second.yaml start docker-compose -f yapi-second.yaml up -d ``` # nginx反向代理配置 可以通过nginx进行反向代理,通过域名访问yapi服务。 ``` #反向代理初始化端口(第一次初始化反向代理,初始化安装) upstream yapi-csh { server 192.168.x.x:9090 weight=5; } server { listen 80; server_name yapi-csh.xxx.com; location / { proxy_pass http://yapi-csh; 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_set_header X-NginX-Proxy true; proxy_set_header Connection "upgrade"; proxy_set_header Upgrade $http_upgrade; proxy_http_version 1.1; } } #反向代理正式访问端口(初始化安装完成,访问yapi服务。) upstream yapi { server 192.168.x.x:3000 weight=5; } server { listen 80; server_name yapi.xxx.com; location / { proxy_pass http://yapi; 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_set_header X-NginX-Proxy true; proxy_set_header Connection "upgrade"; proxy_set_header Upgrade $http_upgrade; proxy_http_version 1.1; } } ```