当前位置:网站首页>Win configuration PM2 boot auto start node project
Win configuration PM2 boot auto start node project
2022-07-07 05:44:00 【Bitter sea 123】
pm2 Be similar to nodemon, But the functional ratio nodemon Richer
1. Global installation pm2, If your system is not installed in advance node Environmental Science , Then you can refer to the blog :https://blog.csdn.net/weixin_46758988/article/details/117109297 ; If you have installed globally pm2, It's just that there is no configuration for boot auto startup , Then you don't need to repeat the installation pm2 了
npm install pm2 -g Or use yarn install ( Use yarn before npm install yarn -g Global installation yarn):yarn global add pm2
2. Global installation pm2 Win Self opening package :pm2-windows-startup:
npm install pm2-windows-startup -g or yarn global add pm2-windows-startup
3. Install configuration package :pm2-startup
pm2-startup install or yarn add pm2-startup
4. Use pm2 Start project , Here you can directly start the index.js or app.js, But it is still recommended pm2 Profile launch project , About pm2 The configuration file can refer to the following configuration file pm2.config.json( If you want more detailed configuration, you can consult the official documents ):
{
"apps":{
"name":"myproject-web", // Alias of the item
"script":"index.js", // Need to start the program's entry file
"watch":"true", // Enable file change monitoring
"ignore_watch":[ // Ignore file changes and listen for files
"node_modules",
"logs"
],
"error_file":"logs/error.log", // Configure the error log output file address
"out_file":"logs/consoles.log", // Configure the print log output file address
"log_date_format":"YYYY-MM-DD HH:mm:ss", // Configure log date format
"instances":2 // The number of cores occupied by the configuration item , Less than or equal to the total number of cores of the server
}
}
5. Start project : Use pm2 Start project , Switch the command line to the project root folder in advance and execute the following command ( If you do not switch to the project file, you can add the project path to the startup at startup :pm2 start route \index.js):
pm2 start pm2.config.json , If not configured pm2 The configuration file , Then you can go directly through :pm2 index.js or pm2 app.js start-up
6. Save this project , It will restart automatically after startup , Such as :
pm2 save
7. Restart the server , The application can be accessed normally , Of course, we usually use the command line to type commands :pm2 list View the currently started project , The command line path here does not require , Such as :
pm2 list
Tips : This article, pictures and other materials come from the Internet , If there is infringement , Please send an email to :[email protected] Contact the author to delete .
The author : misery
边栏推荐
- Flinksql 读写pgsql
- [论文阅读] Semi-supervised Left Atrium Segmentation with Mutual Consistency Training
- The year of the tiger is coming. Come and make a wish. I heard that the wish will come true
- 【Shell】清理nohup.out文件
- 拼多多商品详情接口、拼多多商品基本信息、拼多多商品属性接口
- SAP ABAP BDC(批量数据通信)-018
- The 2022 China low / no code Market Research and model selection evaluation report was released
- Go language context explanation
- Talk about mvcc multi version concurrency controller?
- 分布式全局ID生成方案
猜你喜欢
Zhang Ping'an: accelerate cloud digital innovation and jointly build an industrial smart ecosystem
Digital innovation driven guide
Leakage relay jelr-250fg
JVM the truth you need to know
Simple case of SSM framework
Hcip seventh operation
架构设计的五个核心要素
High voltage leakage relay bld-20
Reading the paper [sensor enlarged egocentric video captioning with dynamic modal attention]
K6el-100 leakage relay
随机推荐
English语法_名词 - 所有格
WEB架构设计过程
Design, configuration and points for attention of network arbitrary source multicast (ASM) simulation using OPNET
R语言【逻辑控制】【数学运算】
Life experience of an update statement
Mybaits之多表查询(联合查询、嵌套查询)
SAP webservice 测试出现404 Not found Service cannot be reached
上海字节面试问题及薪资福利
Distributed global ID generation scheme
不同网段之间实现GDB远程调试功能
Mysql database learning (7) -- a brief introduction to pymysql
Flinksql 读写pgsql
Taobao Commodity details page API interface, Taobao Commodity List API interface, Taobao Commodity sales API interface, Taobao app details API interface, Taobao details API interface
5阶多项式轨迹
分布式事务介绍
SAP ABAP BDC(批量数据通信)-018
Taobao store release API interface (New), Taobao oauth2.0 store commodity API interface, Taobao commodity release API interface, Taobao commodity launch API interface, a complete set of launch store i
English grammar_ Noun possessive
Reading the paper [sensor enlarged egocentric video captioning with dynamic modal attention]
C#可空类型