安装brew https://brew.sh/index_zh-cn
brew search nginx brew install nginx
brew info nginxCentOS7 linux下yum安装redis以及使用
nginx -v
启动sudo brew services start nginx (默认8080)
如果安装过Jenkins的话这里失败 sudo jaunchctl unload /Library/LaunchDaemons/org.jenkins-cj.plist
Systemctl start jenkins
关闭 sudo brew services stop nginx/nginx/
启动nginx 重启nginx -s reload 关闭nginx -s stop
nginx 位置/usr/local/etc/
验证配置文件是否生效 nginx -t
nginx -c xxx.conf 对那个文件生效
拷贝配置文件到node目录重新修改
xxx服务器端的nginx地址 /usr/local/nginx/sbin/
几条绝学
- px aux | grep node
- lsof -i tcp:8080
- kill -9 你的pid
- ssh 用户名@地址 (免密码登录)
- scp course-map json root@IP地址:/路径
- scp -r dist.zip root@101.200.185.250:/opt/:/h/www/static/
- zip dist.zip dist / unzip dist.zip
- npm install --production
- pm2 start pm2.json
-
- 能够动态监控文件上传 0秒热启
- 能负载均衡 CPU
- 内存使用过多 CPU调度台频繁 重启
- 看 restart个数
- pm2 start pm2.json
- nginx主要是配置 upstream 和proxy_pass
worker_processes 1;
events {
worker_connections 1024;
}
http {
#gzip on;
# 负载均衡
upstream mynode {
ip_ip_hash;
#server 0.0.0.0;
#server 0.0.0.0;
}
server {
listen 8080;
server_name localhost;
location / {
#反向代理
proxy_pass http://mynode
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
{
"apps" : [{
"script" : "app.js",
"instances" : "max",
"exec_mode" : "cluster",
"watch": true
}]
}
-
- yum install redis
- service redis start 启动
- service redis stop 停止redis
- service redis status 查看运行状态
- ps -ef | grep redis redis 进程
- chkconfig redis on 设置开机自启动
[CentOS7 linux下yum安装mysql以及使用]
-
- /usr/local/webserver/nginx/sbin/nginx -t
- /usr/local/webserver/nginx/sbin/nginx
- /usr/local/webserver/nginx/sbin/nginx -s reload # 重新载入配置文件
- /usr/local/webserver/nginx/sbin/nginx -s reopen # 重启 Nginx
- /usr/local/webserver/nginx/sbin/nginx -s stop # 停止 Nginx
liunx 安装node
安装V8.x:
- #curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - V7.x:
yum安装node.js
- yum install -y nodejs
3.查看node.js版本 - node -v