PM2命令备忘
安装
1 | npm i -g pm2 |
启动
1 | pm2 start app.js --watch #实时监控app.js的方式启动,当app.js文件有变动时,pm2会自动reload |
1 | npm i -g pm2 |
1 | pm2 start app.js --watch #实时监控app.js的方式启动,当app.js文件有变动时,pm2会自动reload |
学习了Docker基础知识后,我们已经可以使用Dockerfile和docker build命令创建一个镜像,并使用docker run命令运行一个容器。但如果想要同时运行多个容器,并建立容器之间的依赖关系,仅仅依靠上述的命令就显得十分复杂。因此,我们需要一个新的工具能够高效地对多个容器进行运行管理(批量容器编排),这便是Docker Compose。
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. To learn more about all the features of Compose, see the list of features. Compose works in all environments: production, staging, development, testing, as well as CI workflows. You can learn more about each case in Common Use Cases. Using Compose is basically a three-step process:
- Define your app’s environment with a Dockerfile so it can be reproduced anywhere.
- Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.
- Run docker-compose up and Compose starts and runs your entire app.
https://www.bilibili.com/video/BV1og4y1q7M4?from=search&seid=18106350651153543104
不模拟完整的操作系统,系统内核(kernel)非常小,更少的抽象层(GuestOS:如Centos)
容器内的应用直接运行在宿主机的内核,容器本身没有自己的内核,也没有虚拟硬件。
每个容器相互隔离,内部都有属于自己的文件系统,互不影响。
nginx 下载地址:http://nginx.org/download
Nginx (“engine x”)是一个高性能的HTTP和反向代理服务器,特点是占有内存少,并发能
力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好
Nginx专为性能优化而开发,性能是其最重要的考量,实现上非常注重效率,能经受高负载
的考验,有报告表明能支持高达50000个并发连接数。
Nginx 安装简单,配置文件简洁,启动容易且能持续运行。
Nginx 的作用简单来说就是反向代理和负载均衡。
正向代理基于客户端,代理客户端,是一种主动地行为。比如使用 VPN 访问外网,用户需要手动选择香港、日本或美国的节点,通过节点转发到外网服务器,这些节点代理了外网的服务器。
个人使用的环境:
需要一个本地环境: Windows10(64位)电脑一台
云主机:阿里云ECS(CentOS 7.3 64位)。
整个部署过程:
本地环境搭建(Git,NodeJs,Hexo),云主机环境搭建(Git,宝塔面板一键部署Nginx)
使用git自动化部署博客
本地Win10搭建环境
安装Git(下载安装包,打开后一直下一步到结束就行) 安装Nodejs(下载安装包,打开后一直下一步到结束就行) 安装Hexo下面详细讲解安装步骤
我部署在D:/blog 中,你根据自己的习惯定义部署位置,不建议C盘,避免系统损坏后导致文件丢失。 打开D盘,新建blog文件夹,打开blog文件夹,右键git bush here”。 执行如下命令