Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesPM2 keeps a Node.js application running as a managed background service on your VPS. Install it globally, start each app with a stable name, save the process list, and configure PM2 startup so the service returns after a reboot. For multiple applications, an ecosystem file centralizes working directories, instance counts, environment settings, memory limits, watches, and log files.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
This guide covers the complete operating workflow: first launch, safe restarts, reboot persistence, multi-process scaling, graceful releases, logging, and the failure cases that commonly leave a VPS serving an old or stopped process.
As an Amazon Associate I earn from qualifying purchases.
What PM2 does on a VPS
PM2 is a daemon process manager for keeping applications online. Instead of tying your Node.js process to an SSH session, PM2 runs a supervisor in the background. It records the processes you start, reports their state, captures standard output and errors, and can restart a process when it exits or exceeds a configured memory threshold.
PM2 does not replace your application, database, firewall, TLS configuration, or reverse proxy. It manages the Node.js process layer. You still need a VPS with Node.js installed, an application that can bind to its configured port, and a deployment layout that your service account can read and execute.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
The basic operating pattern is:
- Install PM2 globally.
- Start the application and assign a stable process name.
- Check the process list and logs.
- Save the process list.
- Run PM2’s startup setup and execute the generated privileged command.
- Use lifecycle commands or an ecosystem file for later changes.
Prerequisites and a safe VPS layout
Before installing PM2, make sure the VPS has:
- A supported Node.js installation available to the account that will run the app.
- Your application files, production dependencies, and any build output already deployed.
- A known entry point such as
app.jsand a documented listening port. - Environment variables for production configuration, with secrets kept out of source control.
- File permissions that allow the service account to read the application and write its configured logs.
- A plan for exposing the app safely, normally by placing a reverse proxy in front of Node.js rather than opening every application port publicly.
Use one service account consistently. Starting PM2 as one user and later running it as another creates separate process lists and startup services, which can make an apparently missing application look like a PM2 failure.
Install PM2 and start your first app
- Install the current PM2 release globally with
npm install pm2@latest -g. Yarn can be used instead if that is your standard package manager. - Change to the application directory, for example
cd /var/www/my-node-app. - Start the entry point:
pm2 start app.js --name my-node-app. The explicit name is important; it keeps commands and logs unambiguous when several apps share the VPS. - Confirm that PM2 registered the process with
pm2 list. The equivalent commands arepm2 lsandpm2 status. - Read recent output with
pm2 logs my-node-app. If you need more history, usepm2 logs my-node-app --lines 200.
A status of online means PM2 has a running process. It does not prove that the application is reachable through your public domain, that a database connection works, or that the process is listening on the expected interface. Check the app’s own health endpoint or local port separately.
PM2 lifecycle commands you will use every day
Use the process name rather than relying on a changing numeric ID. Names remain understandable in deployment scripts and incident notes.
| Operation | Command | When to use it |
|---|---|---|
| List processes | pm2 list |
Check names, IDs, status, restarts, CPU, and memory. |
| Start an existing script | pm2 start app.js --name my-node-app |
Register a new application. |
| Restart | pm2 restart my-node-app |
Stop and start workers again; connections may be interrupted. |
| Reload | pm2 reload my-node-app |
Prefer for cluster-mode releases when graceful replacement is configured. |
| Stop | pm2 stop my-node-app |
Temporarily halt the process while retaining its PM2 definition. |
| Delete | pm2 delete my-node-app |
Remove the process from PM2’s managed list. |
| Tail logs | pm2 logs my-node-app |
Inspect application output and errors in real time. |
| Terminal monitor | pm2 monit |
Watch process health, resource use, and output interactively. |
After changing a process definition, run pm2 save when you want that new state to be restored at the next boot. Saving is separate from starting or restarting; a process can be online now but absent after a reboot if the saved list was never updated.
Manage multiple apps with an ecosystem file
An ecosystem file turns one-off commands into version-controlled configuration. Generate a starter file with pm2 ecosystem or pm2 init simple, then edit it to match your deployment. Keep the file with your infrastructure or application configuration, but do not commit secrets.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
The following example demonstrates the major settings that matter on a small VPS:
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →module.exports = {
apps: [
{
name: "api",
script: "./dist/api.js",
cwd: "/var/www/api",
args: "",
instances: 2,
exec_mode: "cluster",
env: {
NODE_ENV: "development",
PORT: 3000
},
env_production: {
NODE_ENV: "production",
PORT: 3000
},
max_memory_restart: "500M",
watch: false,
ignore_watch: ["node_modules", "logs"],
error_file: "/var/log/my-node/api-error.log",
out_file: "/var/log/my-node/api-out.log",
merge_logs: true,
wait_ready: true,
listen_timeout: 10000,
kill_timeout: 5000,
autorestart: true,
restart_delay: 3000,
max_restarts: 10,
min_uptime: "10s"
},
{
name: "worker",
script: "./dist/worker.js",
cwd: "/var/www/worker",
instances: 1,
exec_mode: "fork",
env_production: {
NODE_ENV: "production"
},
max_memory_restart: "300M",
watch: false,
error_file: "/var/log/my-node/worker-error.log",
out_file: "/var/log/my-node/worker-out.log",
merge_logs: true
}
]
};
Start the production environment block with pm2 start ecosystem.config.js --env production. PM2 applies values from env_production instead of the default env block. Verify the resulting values with pm2 list and your application logs.
Choosing paths and names
cwd makes relative script paths, configuration files, and generated assets predictable. Give every app a unique name. Separate error_file and out_file paths make diagnosis easier; merge_logs combines output from multiple workers when a single stream is more convenient.
Environment variables and secrets
Use PM2’s environment blocks for non-secret settings such as NODE_ENV and ports. Keep passwords, tokens, private keys, and database credentials outside committed ecosystem files. Inject them through the VPS environment or a secrets mechanism appropriate to your infrastructure. PM2 documents environment-variable configuration but does not require one particular secret manager.
Memory and restart controls
max_memory_restart asks PM2 to restart a process after it exceeds the configured threshold. This is a recovery guard, not a substitute for finding a leak. Restart controls such as autorestart, restart_delay, max_restarts, and min_uptime help prevent a crash loop from consuming the VPS and make repeated failures visible in the process list.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
Watch mode
File watching can be useful during development, but it is usually inappropriate for a production VPS because deployments, generated files, and log writes can trigger unexpected restarts. Set watch: false in production unless you have a deliberate reason to enable it, and use ignore_watch for directories that must never trigger a restart.
Make PM2 survive SSH disconnects and reboots
PM2 already detaches your app from the terminal, so closing SSH does not stop a normally managed process. A reboot is different: the operating system terminates all processes, and PM2 must be registered to start again.
- Run
pm2 startupas the account that owns the applications. - PM2 prints a platform-specific command that must be executed with the required privileges. Copy that generated command exactly and run it.
- Start or update the applications you want restored.
- Run
pm2 saveto write the current process list for boot-time restoration. - Test during a maintenance window: reboot the VPS, reconnect, run
pm2 status, and inspect logs.
If you use NVM, the startup service depends on the Node.js path available when startup was configured. After changing Node.js versions or NVM paths, rerun the startup setup and save the process list again. Otherwise the boot service may call an old or unavailable Node binary even though interactive SSH sessions use the new version.
Logs, monitoring, and disk safety
Start with pm2 logs for all applications or include a name to narrow the stream. The --lines 200 option displays a useful recent window without requiring you to open the entire file. Use pm2 monit when you need a live terminal dashboard for CPU, memory, restarts, and output.
Free tools Windows power users keep installed
One-click scans. No signup required.
Logs are operational data, not an unlimited archive. Define explicit output and error paths, check ownership and permissions, and decide how files will be rotated or retained. Without rotation, a noisy application can fill the VPS disk; once the filesystem is full, databases, deployments, and even SSH can fail. External log rotation or a centralized logging system can enforce retention, compression, and alerting.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
When a process repeatedly restarts, note the restart count and inspect both streams. A syntax error, missing environment variable, wrong working directory, unavailable dependency, failed database connection, or port collision normally appears in the application error output. PM2 can keep restarting a process, but it cannot correct the underlying configuration.
Fork mode versus cluster mode
Fork mode runs an application as a normal independent Node.js process. It is the simplest choice for a worker, a stateful service, or an app that is not designed for multiple workers. Cluster mode starts multiple workers and distributes supported connections among them.
| Decision point | Fork mode | Cluster mode |
|---|---|---|
| Process count | Usually one process per definition | Multiple workers from one definition, using instances or a command such as pm2 start app.js -i max |
| State requirements | Can keep state locally, subject to restart loss | Application should be stateless or externalize shared state |
| Connection distribution | No PM2 worker balancing | PM2 distributes HTTP, HTTPS, WebSocket, TCP, and UDP connections among workers |
| Reload behavior | Restart normally interrupts the process | pm2 reload can replace workers while reducing downtime |
| Operational complexity | Lower | Higher: readiness, shutdown, shared sessions, and logs need deliberate handling |
| Logs | One process stream | Several worker streams; use separate files or merge_logs |
Cluster workers do not automatically synchronize in-memory sessions, caches, counters, or other state. Put shared state in an external system or use a design that does not depend on a particular worker receiving the next request. Confirm that WebSocket behavior, session affinity, and background jobs are safe before increasing instances.
Graceful shutdowns and safer releases
A reload is only graceful if the application cooperates. On shutdown, stop accepting new work, finish or cancel active requests, close database and queue connections, and exit within the time PM2 allows. A basic Node.js pattern is:
let shuttingDown = false;
async function shutdown(signal) {
if (shuttingDown) return;
shuttingDown = true;
server.close(async () => {
await database.close();
process.exit(0);
});
setTimeout(() => process.exit(1), 5000).unref();
}
process.on("SIGINT", () => shutdown("SIGINT"));
process.on("SIGTERM", () => shutdown("SIGTERM"));
If you use readiness signaling, set wait_ready: true and have the worker notify PM2 only after it has loaded configuration and is ready to accept traffic. listen_timeout controls how long PM2 waits for that readiness state. kill_timeout gives a worker time to finish shutdown before PM2 forces termination. Match these values to your application’s actual startup and drain times rather than copying arbitrary numbers.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
For a release, deploy the new files, install dependencies, verify configuration, then run pm2 reload for the affected cluster application. Watch logs and readiness during the replacement. Use pm2 restart when a full interruption is acceptable or when the app cannot perform a graceful reload.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Put a reverse proxy in front of Node.js
PM2 does not terminate TLS or provide domain-based routing. A reverse proxy can accept public HTTP and HTTPS traffic, handle certificates, route several domains or paths to different local ports, buffer requests, and keep application ports private. This also gives you one place to observe access logs and enforce request limits.
Bind the Node.js app to the interface and port required by your proxy, then expose only the proxy’s public ports through the VPS firewall. Do not assume that a process shown as online is correctly protected: verify that direct access to the internal application port is restricted and that the proxy forwards health checks, WebSockets, and large requests according to your app’s needs.
Operating several applications on one VPS
- Give every process a unique name and a distinct working directory.
- Assign non-conflicting local ports, or use a routing layer that maps domains to those ports.
- Keep each app’s output and error logs identifiable, either with separate paths or deliberate merged logs.
- Use an ecosystem file to record instance counts, modes, environment blocks, restart policies, and memory thresholds.
- After a planned change, run
pm2 saveso reboot recovery matches the intended set of applications. - Monitor aggregate memory and CPU. A VPS can become unhealthy even when each individual process appears acceptable.
Do not use cluster mode merely because the VPS has spare CPU. Additional workers multiply memory use and can expose bugs in session handling, job scheduling, and local caches. Increase the count only after measuring your application’s behavior and confirming that shared state is externalized.
Troubleshooting common PM2 failures
The app disappears after reboot
- Run
pm2 statusas the same user that owns the app. - Run
pm2 startupagain if Node.js was upgraded or its path changed, especially with NVM. - Execute the generated privileged command, then run
pm2 save. - Check that the startup service uses the intended account, working directory, and Node binary.
PM2 says online, but the site is unreachable
- Read
pm2 logs app-name --lines 200for bind errors and startup exceptions. - Confirm the application is listening on the port configured in the ecosystem file.
- Test the local endpoint from the VPS before investigating DNS or the public network.
- Check reverse-proxy routing, firewall rules, TLS configuration, and whether the app is bound only to loopback.
The process restarts continuously
- Inspect the error log for missing modules, invalid syntax, failed configuration, or a dependency that is unavailable at boot.
- Check the restart count in
pm2 list. - Verify that
cwdand the script path point to the deployed build, not a deleted release directory. - Review
max_memory_restartand available VPS memory; a threshold that is too low can create a restart loop. - Temporarily stop the process, correct the cause, then start it again and save the corrected state.
A reload drops requests
- Confirm the app handles
SIGTERMand closes its server gracefully. - Use cluster mode with more than one healthy worker before relying on reload for reduced downtime.
- Enable
wait_readyonly when the app sends a readiness signal, and setlisten_timeoutlong enough for real startup time. - Increase
kill_timeoutwhen legitimate requests need more time to drain, while ensuring hung workers cannot remain indefinitely.
Logs are missing or cannot be written
- Check the configured
error_fileandout_filepaths. - Ensure the PM2 service account owns or can write to the log directory.
- Look for disk exhaustion and log-rotation moves that changed ownership.
- Use
pm2 logsto confirm whether PM2 is receiving output even when a custom path is misconfigured.
Production checklist
- Install PM2 globally for the correct Node.js installation and service account.
- Start every app with a stable, unique name.
- Verify status, local connectivity, and logs before putting traffic on the process.
- Store repeatable settings in an ecosystem file under version control.
- Keep secrets outside committed configuration and inject them at runtime.
- Choose fork mode for simplicity and cluster mode only when the app is safe for multiple workers.
- Externalize sessions, caches, and other state that cluster workers must share.
- Implement graceful shutdown and readiness signaling before using reload as a low-downtime release method.
- Configure memory and restart controls, then investigate repeated restarts instead of hiding them.
- Plan log retention and rotation before production traffic grows.
- Run
pm2 startup, execute its generated command, and runpm2 save. - After a reboot or Node.js upgrade, verify the restored process list as the owning user.
What PM2 can and cannot guarantee
PM2 improves process supervision, restart handling, deployment consistency, and operational visibility. It does not guarantee universal uptime, eliminate application bugs, synchronize worker memory, or provide a performance figure that applies to every VPS. Capacity depends on the Node.js workload, dependency behavior, traffic pattern, worker count, and available CPU, memory, storage, and network resources.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Treat PM2 as one layer in a complete service: application health checks, backups, security updates, firewall rules, database reliability, reverse-proxy configuration, and an alerting plan remain necessary. With those pieces in place, the combination of named processes, an ecosystem file, saved startup state, controlled reloads, and bounded logs gives you a repeatable way to run Node.js services beyond the lifetime of an SSH session.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




