Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit edfaac3

Browse files
committed
docs: update publish.md
1 parent 8aca9c8 commit edfaac3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/guide/publish.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,23 @@ pm2 有以下的几个非常给力的能力:
3131
$ npm install -g pm2
3232
```
3333

34+
- 编写启动文件app.js
35+
36+
```
37+
const egg = require('egg')
38+
39+
const workers = Number(process.argv[2] || require('os').cpus().length)
40+
egg.startCluster({
41+
workers,
42+
baseDir: __dirname
43+
})
44+
45+
```
46+
3447
- 使用 pm2 部署简单的项目
3548

3649
```
37-
$ pm2 start app.js --name "egg-react-cli" -i 0 --watch
50+
$ EGG_SERVER_ENV=prod pm2 start app.js --name "egg-react-ssr" -i 0 --watch
3851
3952
pm2 start: 使用pm2启动 app.js
4053
-i 0: 使用最大进程数启动

0 commit comments

Comments
 (0)