安装工具shell
用ssh链接远程服务器
ssh root@远程服务器地址
升级本地库
sudo apt-get update
用apt-get安装git vim openssl build-essential libssl-dev wget curl
sudo apt-get install git vim openssl build-essential libssl-dev wget curl
安装node
安装nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
设置nvm默认v8版本
nvm use v10.8.0
nvm default alias v10.8.0
查看node版本
node -v
设置防火墙
sudo iptables -restore < /etc/iptables.up.rules
vi /etc/iptables.up.rules
编辑iptables.up.rules
添加防火墙规则
vi /etc/iptables.up.rules
#website
-A INPUT -s 127.0.0.1 -p tcp --destination-port 3006 -m state --state NEW, ESTABLISHED -j ACCEPT
-A OUTPUT -d 127.0.0.1 -p tcp --source-port 3000 -m state --state ESTAB
LISHED -j ACCEPT
安装yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
设置yarn
淘宝源
yarn config set registry https://registry.npm.taobao.org
全局安装vue-cli pm2
npm install vue-cli pm2 -g
pm2 接管server.js启动
pm2 start server.js
pm2 list
pm2 show server
pm2 stop server
pm2 log
pm3 restart server
停止和卸载apache2
sudo service apache2 stop
安装nginx
sudo apt-get install nginx
编辑nginx配置文件
cd /etc/nginx/conf.d/
vi ice-aaayia-top.conf
nginx配置文件添加:
upstream ice {
server 127.0.0.1:300;
}
server {
listen 3000;
server_name ice.aaayia.top;
location / {
# 后端的Web服务器可以通过X-Forwarded-For获取用户真实IP
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X_Nginx_Proxy true;
proxy_pass http://ice;
proxy_redirect off;
}
error_log logs/error_www.abc.com.log error; (这是查看错误日志文件的位置)#/usr/share/nginx/logs/error_www.abc.com.log
}
开启nginx服务
nginx -t
service nginx restart
安装mongoDB
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64,arm64 ] http://mirrors.aliyun.com/mongodb/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
修改mongodb安装源
https://repo.mongodb.org => https://mirrors.aliyun.com/mongodb
sudo apt-get update
sudo apt-get install -y mongodb-org
开启mongodb
service mongod start
查看mongodb日志
cat /var/log/mongodb/mongod.log
编辑mongod.conf
文件
vi /etc/mongod.conf
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
//绑定IP和端口
net:
port: 27017
bindIp: 127.0.0.1
//验证方法为帐号登陆
security:
authorization: 'enable'
修改防火墙
vi /etc/iptables.up.rules
#modgodb
-A INPUT -s 127.0.0.1 -p tcp --destination-port 27017 -m state --state NEW, ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 27017 -m state --state ESTAB
LISHED -j ACCEPT
网友评论