CentOS服務器配置node環境

  • (yum -y install wget)
  • firewall-cmd --zone=public --add-port=3389/tcp --permanent
  • --no-check-certificate
  • yum -y install vim
  • ps -ef|grep mongodb
  • npm config set strict-ssl false
  • git config --global http.sslVerify false
  • db.User.update({},{$unset:{'cashopenid':''}},false, true)
  • db.copyDatabase(“db2″,”db1″,”localhost”)
  • 防火牆:https://www.cnblogs.com/moxiaoan/p/5683743.html

 

 

1.安裝git

  • yum install git
  • git config --global user.name "yyx_com"
  • git config --global user.email "[email protected]"
  •  
  • git config --list ————查看配置信息

 

 

2.安裝node

  • wget https://nodejs.org/dist/v9.11.1/node-v9.11.1-linux-x64.tar.xz
  • tar -xvf node-v9.11.1-linux-x64.tar.xz
  • mv ./node-v9.11.1-linux-x64 ./node
  • ln -s /root/node/bin/node /usr/local/bin/node
  • ln -s /root/node/bin/npm /usr/local/bin/npm
  • npm install -g cnpm --registry=https://registry.npm.taobao.org
  • ln -s /root/node/bin/cnpm /usr/local/bin/cnpm
  • cnpm i pm2 -g
  • ln -s /root/node/bin/pm2 /usr/local/bin/pm2

 

3.安裝mongodb

  • wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.2.6.tgz
  • tar zxvf mongodb-linux-x86_64-rhel70-3.2.6.tgz
  • mv ./mongodb-linux-x86_64-rhel70-3.2.6 ./mongodb

 

  • mkdir /root/mongo
  • mkdir /root/mongo/data
  • mkdir /root/mongo/logs

 

  • cd mongodb
  • vim mongodb.conf

dbpath=/root/mongo/data

logpath=/root/mongo/logs/mongodb.log

port=27017

fork=true

nohttpinterface=true

auth=false

  • ./bin/mongod -f ./mongodb.conf
  • db.copyDatabase('text', 'text', '120.79.210.232:27017', 'root', '18786700454')
  • db.createUser( { user: "yyx", pwd: "18786700454", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } )
  • db.createUser( { user: "root", pwd: "18786700454", roles: [ { role: "readWrite", db: "text" } ] } )

5.clone

  • 前臺:git clone https://gitee.com/494203508/blackG.git
  • 後臺:git clone https://gitee.com/494203508/blackGB.git

 

 

4.Caddy配置

www.diarymoon.top

{

gzip #開啓gzip壓縮

proxy / http://127.0.0.1:3389 {

header_upstream Host {host}

header_upstream X-Real-IP {remote}

header_upstream X-Forwarded-For {remote}

header_upstream X-Forwarded-Proto {scheme}

}

}

 

http://book.diarymoon.top

{

gzip #開啓gzip壓縮

proxy / http://127.0.0.1:3000 {

header_upstream Host {host}

header_upstream X-Real-IP {remote}

header_upstream X-Forwarded-For {remote}

header_upstream X-Forwarded-Proto {scheme}

}

}

 

(caddy -conf="/usr/local/bin/Caddyfile" &)

 

wget https://youxiu123.oss-cn-hangzhou.aliyuncs.com/mongodb-linux-x86_64-rhel70-3.2.6.tgz

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章