首先安装6.x版本的node
wget https://registry.npmmirror.com/-/binary/node/latest-v6.x/node-v6.17.1-linux-x64.tar.gz tar zxvf node-v6.17.1-linux-x64.tar.gz
重命名node
mv node-v6.17.1-linux-x64 /usr/local/node
添加环境变量
vi /etc/profile
在文件最后添加以下配置:
export NODE_HOME=/usr/local/node export PATH=$NODE_HOME/bin:$PATH
5.刷新配置
source /etc/profile
6.验证结果:
node -v npm -v
拉取源码:
git clone https://github.com/mrvautin/adminMongo.git && cd adminMongo
安装依赖包:
npm install
编辑配置文件:
vi config/app.json
写入配置信息:
{ "app": { "host": "127.0.0.1", "port": 4321, "password": "secureadminpassword", "locale": "zh-cn", "context": "dbApp", "monitoring": false } }
配置nginx反代
server { listen 80; server_name mydomain.com www.mydomain.com; location /dbApp { proxy_pass http://127.0.0.1:4321/dbApp; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
启动脚本:
npm start或者node app