天天看點

可視化接口管理平台yapi本地部署

一、安裝依賴環境

1、安裝MongoDB,添加管理者使用者,開啟auth驗證,添加yapi集合及使用者

db.createUser({ user: "root", pwd: "xxxxxx", roles: [{ role: "userAdminAnyDatabase", db: "admin" }] })
db.createUser({ user: "yapi", pwd: "xxxxxx", roles: [{ role: "readWrite", db: "yapi" }] })
           

2、 安裝node環境

3、安裝yapi

參照官方文檔 https://hellosean1025.github.io/yapi/devops/index.html 
mkdir yapi
cd yapi
下載下傳 zip 包解壓到 vendors 目錄
cp vendors/config_example.json ./config.json //複制完成後請修改相關配置
cd vendors
npm install --production --registry https://registry.npm.taobao.org
npm run install-server //安裝程式會初始化資料庫索引和管理者賬号,管理者賬号名可在 config.json 配置
node server/app.js //啟動伺服器後,請通路 127.0.0.1:{config.json配置的端口},初次運作會有個編譯的過程,請耐心等候
           

4、配置nginx

server
{
	listen 80;
	server_name yapi.xuexi8.net;

	location / {
        proxy_pass http://localhost:3000;
        p
           

繼續閱讀