How to use a Node.js application on cPanel hosting

Procédure

Node.js is a server-side JavaScript runtime that makes it possible to design and run modern websites and web applications. On cPanel web hosting, your applications are supported by Phusion Passenger, which launches your script with the chosen version and handles requests without port configuration or tools like pm2. This tutorial details creating an application, deploying your code, and managing it day to day.

Create the application in cPanel

To initialize the runtime environment, log in to your cPanel interface, then click Setup Node.js App in the Software category.

  1. Open the add form

    On the tool's main page, click the blue CREATE AN APPLICATION button at the top right.

    How to use a Node.js application on cPanel hosting
  2. Fill in the project settings

    Complete the displayed fields according to your project:

    • Node.js version: select the required version from the list provided (from 6.17.1 to 26.13.1).
    • Application mode: choose Development or Production (this choice defines the NODE_ENV environment variable).
    • Application root: specify the folder containing the source files (for example my-node-app). Never place this folder in public_html.
    • Application URL: choose the associated domain name and type the publication subfolder in the URL (for example nodeapp), or leave it blank for the site root.
    • Application startup file: specify the name of the main file (such as app.js or server.js).

    Then click CREATE at the top right to finalize creation.

    How to use a Node.js application on cPanel hosting
  3. Check the initial startup

    If the startup file did not yet exist, the system generates a working sample script. Click the OPEN button located to the right of the Application URL field.

    How to use a Node.js application on cPanel hosting

Deploy your code and install dependencies

Once the environment is created, replace the sample script with your project code and install your Node modules.

  1. Upload the application files

    Go to your project directory (for example /home/user/my-node-app) using an FTP client or the cPanel file manager. Upload your JavaScript files as well as your package.json file.

  2. Install modules with NPM

    Go back to Setup Node.js App and open your application's details page. In the Detected configuration files block (the interface remains partly in English), click the Run NPM Install button as soon as the package.json file is detected.

  3. Add environment variables

    If your code uses API keys or specific credentials, go to the Environment variables section. Click ADD A VARIABLE, fill in the name and value, then click the blue SAVE button at the top right.

    How to use a Node.js application on cPanel hosting
  4. Restart the application

    To apply the new files, modules, or variables, click RESTART next to STOP THE APPLICATION on the project details page, or click the circular arrow icon in the list of web applications.

    How to use a Node.js application on cPanel hosting

Understanding how shared hosting works and its specifics

On cPanel hosting, execution is handled by Phusion Passenger. This Apache module uses a specific behavior that differs from a dedicated server.

  • Startup commands cannot be used: Commands such as node server, npm run start or pm2 start do not work on shared hosting. Passenger directly runs your startup file with the selected Node version and intercepts the call to the HTTP server's listen() function.
  • Framework compatibility: If you use a specific JavaScript framework, make sure it is compatible with deployment under Phusion Passenger.
  • Port management: You do not have a network port number to choose. Passenger handles the link between Apache HTTP requests and your application.
  • Command-line environment access: If you use an SSH connection, copy the source .../activate command displayed on your application's management page. It activates the virtual environment with the correct paths for Node and NPM.

Check the error logs

If there is an issue when loading your site, you can check the Apache error log to identify the cause. In cPanel, open the Metrics category, then click Errors.

This log collects standard output (STDOUT), execution errors (STDERR) from your Node.js code, as well as messages from Passenger and the Apache web server.

Browse the latest recorded entries or use the filter field to locate messages related to your project's startup file.

How to use a Node.js application on cPanel hosting

Delete the application

To completely remove a project from your cPanel hosting, follow the cleanup procedure in order.

  1. Destroy the application in cPanel

    In Setup Node.js App, open your project's configuration and click the red DESTROY button at the top right (or the trash icon in the application list), then confirm the prompt.

  2. Delete leftover files

    Deleting in the cPanel interface does not remove your folders from disk. Open the cPanel file manager or connect via FTP, then manually delete the root of your project (for example the my-node-app folder) as well as the associated virtual folder located in the nodevenv/ directory.

Check that everything works

To validate that your application has been set up correctly, open a web browser and go to the configured URL (for example https://example.com/nodeapp). Your homepage or your Node.js application's API must respond correctly without generating an HTTP 500 or 503 error. If you tested the sample script generated during creation, the page should display the welcome message.

How to use a Node.js application on cPanel hosting

Common issues

I can't create the application: the folder is already in use

The message “Specified directory already used” indicates that an application (Node.js, Python, or Ruby) is already linked to this URL, or that the application's root folder points to the same directory as the URL. Open the cPanel file manager, go to the URL publication folder (located in public_html) and check its .htaccess file to see whether it contains old redirect rules. Also make sure that your project's physical root is indeed located outside public_html.

Module installation stops

If the execution of Run NPM Install stops prematurely, the process may have exceeded the time or memory limits allocated to the shared account. Start by trying again or by lightening your dependencies in package.json. If you use an SSH connection, first load the environment with the source .../activate command indicated on your application's page, then run the installation while explicitly allocating memory: NODE_OPTIONS='--max-old-space-size=2048' npm install.

My site displays a 500 error

A 500 error most often comes from a directive not supported by the server in the Apache configuration. Open the cPanel file manager, go to the folder corresponding to the application URL (for example public_html/nodeapp), first make a backup copy of your .htaccess file (by renaming it, for example, .htaccess.bak), then edit the .htaccess file. Check whether lines such as PassengerPoolIdleTime, PassengerMinInstances or PassengerStartTimeout have been added there. Remove these lines and save. If the error persists, restore the .htaccess.bak copy and consult the Apache error log in cPanel.

Related articles

Useful links

help.lws.net/a/1255
Was this article helpful?

Yes

No

Read 68 511 times

Thank you! Feel free to ask questions about our documentation if you would like more information, and help us improve it.

Similar articles

Questions about the article 5

ckothor7
13 Apr 2023
Peut-on deployer une application angular sur vos serveurs ??
Benjamin-LWS Official answer
14 Apr 2023

Hello,

Thank you for your feedback.

It's perfectly possible to deploy an Angular.js application on our cPanel packages.

To do so, go to your cPanel and search for "Softaculous Apps Installer".

Then in the new page that opens,search for "Angular" in the top left-hand search bar. Now you can install Angular on your cPanel.

I'd like to thank you for your attention and remain at your disposal should you have any further questions or require additional information.

We invite you to contact our support department via your customer area, so that we can help you if you encounter any difficulties (https://aide.lws.fr/a/268).

Sincerely, The LWS Team

Was this answer helpful?
NourMaher
1 Aug 2023
Pourquoi J'arrive pas a creer l'application???
Aurelien-LWS Official answer
2 Aug 2023

Hello,

Thank you for your message.

The reasons that prevent you from creating or running a Node.JS application can be numerous and require more information to be accurately analyzed.

I invite you to contact our technical support team from the "support" section of your customer area so that an agent can take charge of your request and solve your problem.

Sincerely, The LWS team

Was this answer helpful?
LAWRENCE
25 Feb 2025
Comment installer une application Expressjs sur un VPS LWS
Jordan-LWS Official answer
25 Feb 2025

Bonjour,

Je vous remercie pour votre message. 

Pour ce type de demande, il est recommandé de faire appel au service dédié, qui sera en mesure de vous guider de manière plus précise. De plus, cela permettra d'avoir un échange direct avec eux, ce qui facilitera le déploiement de votre application Node.js (Express.js) sur votre VPS.

N'hésitez pas à les contacter pour plus d’assistance.

Cordialement, L'équipe LWS

Was this answer helpful?
Samm
29 Jun 2025
Peut-on utiliser php et node.js en même temps sur l'hébergement Cpanel ? Ou bien l'installation de node.js annule celle de PHP ?
Jordan-LWS Official answer
1 Jul 2025

Bonjour,

Merci pour votre question.

Sur un hébergement cPanel, il est tout à fait possible d’utiliser PHP et Node.js en parallèle. L’installation d’une application Node.js n’annule pas le support de PHP : les deux peuvent coexister sur le même compte, à condition que chaque technologie soit utilisée dans un contexte bien séparé (par exemple, des sous-répertoires ou des sous-domaines dédiés).

Si vous avez besoin d’aide pour vous assister, notre équipe technique se tient à votre disposition pour vous accompagner.

Cordialement, L'équipe LWS 

Was this answer helpful?
marx
il y a 9 mois
bonjour peut on deployer une app nodejs avec la formule cpanel M2 avec une precision que c'est un site fait avec Next.js
Jordan-LWS Official answer
il y a 9 mois

Bonjour,

Oui, il est tout à fait possible de déployer une application Node.js avec la formule cPanel M2.

En effet, via cPanel, vous disposez de la fonctionnalité permettant de configurer et déployer des applications Node.js. Cela inclut donc les projets développés avec Next.js, sous réserve que l’application soit correctement configurée pour un environnement d’hébergement mutualisé.

Il sera notamment nécessaire de :

  • Configurer l’application via l’outil Node.js dans cPanel

  • Définir la version de Node.js adaptée à votre projet

  • Indiquer le fichier de démarrage (ex : app.js, server.js ou configuration adaptée selon votre build Next.js)

  • Lancer le build si nécessaire (sous certaines limites)

Si besoin, l’assistance peut apporter une vérification de votre configuration afin de s’assurer que le déploiement est conforme.

Cordialement, L'équipe LWS

Was this answer helpful?

Need more help?

A question about this article?

Léo, our assistant, answers you straight away based on our articles.

A problem with your account?

Our technical support team handles your request by ticket, from your customer area.

Open a ticket