diff --git a/README.md b/README.md index 38a6229..22dfde8 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,15 @@ Start the server npm run start ``` +Or Start as Background Process with PM2: Process Manager (For Production) ~ Tested with Ubuntu 20 server + +```bash +# example of PATH_PM2 is /www/server/nodejs/v18.13.0/bin/pm2 or you can use pm2 instance +sudo PATH_PM2 start ecosystem.config.js + +* FORK or CLUSTER ? -> readmore [here](https://stackoverflow.com/a/36177256) +``` + Open On Browser & Start New Session ```bash diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..c0e71b7 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,14 @@ +module.exports = { + apps : [ + { + name : "Start as Background Process with PM2", + script : "./index.js", + instances : "1", + exec_mode : "fork", + env: { + NODE_ENV: "production", + PORT: 3007 + } + } + ] + } \ No newline at end of file