Spring Fresh Sale! - Up To 67% OFF BDIX Hosting + Free Domain
Node.js

How to Restart a Node.js App in cPanel (and Why touch tmp/restart.txt Works)

You restart a Node.js app in cPanel either with the Restart button in Setup Node.js App, or by creating (or updating) a file at tmp/restart.txt in your application root. A restart is needed whenever you change code, dependencies, the Node version, or environment variables.

The simple way: the Restart button

  1. Open Setup Node.js App in cPanel.
  2. Click Edit on your application.
  3. Click Restart.

The developer way: touch tmp/restart.txt

cPanel runs Node apps under Phusion Passenger, which watches for a file at tmp/restart.txt in your app root. When that file's timestamp changes, Passenger restarts the app on the next request. Over SSH or in a deploy script:

mkdir -p tmp && touch tmp/restart.txt

This is handy for automating restarts after a deployment, without opening cPanel. It works because of how Passenger operates β€” see what Phusion Passenger is.

When you need to restart

Frequently asked questions

Why doesn't touch tmp/restart.txt restart immediately?

Passenger restarts the app on the next request after the file changes, not the instant you touch it. Load the site once and the fresh instance starts.

The tmp folder doesn't exist β€” what do I do?

Create it in your application root (mkdir -p tmp), then touch restart.txt inside it. Passenger looks for the file at that path relative to your app root.

My changes still aren't showing after a restart.

Confirm you edited files in the correct application root and that the app actually restarted. Clear any caching, and check the logs β€” see viewing Node.js logs in cPanel.

Was this article helpful?