Rate this article :
3.2/5 | 14 opinion
This article was useful to you ?
Yes
No
Vous avez noté 0 étoile(s)
Sommaire
Procédure
Node.js is an open-source, cross-platform runtime environment that lets you create a website or application and host it on a server, using the JavaScript language. On our cPanel and CloudCP packages, we provide you with the Node.js application manager so you can set up a Node.js application on your cPanel web hosting package. Node.js versions 6.x to 20.x are available.
To provide our customers with a stable and robust environment for Node.js, we integrate your Node.js applications with the Apache web service using the Phusion Passenger tool.
We do not set up a reverse proxy, and Node.js applications cannot run standalone on their own web server. If you are used to running your Node.js server with a command such as npm run start or pm2 start myapp, you will not be able to do this on our cPanel hosting packages. If you use a framework, find out whether it is compatible with Phusion Passenger.
Connect to your cPanel management interface and click on the"Setup Node.js App" icon.
On the page that follows, click on the"Create Application" button to add a new application.
Then fill in the fields as required for your application:
Then click on the"Create" button once your application has been set up.
If your application startup file does not yet exist, the tool will immediately create this file with sample content. This example will display " It works! " on all HTTP requests associated with it.
Here are the contents of this example script :
var http = require('http'); var server = http.createServer(function(req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); var message = 'It works!\n', version = 'NodeJS ' + process.versions.node + '\n', response = [message, version].join('\n'); res.end(response); }); server.listen();
You can also edit the package.json file from the interface to add dependencies and install these dependencies using the " Run NPM Install " button:
Note that you need to restart your application if its dependencies have been modified.
You can also define environment variables in the Environment variables section if your application relies on them to obtain certain parameters.
Using the command line terminal is an integral part of the Node.js ecosystem. To access your application's environment from the terminal, connect to it (from the cPanel web terminal or from an SSH client) and copy the command shown to enter your application's environment:
This action will automatically activate the correct virtual environment for your application, including the correct version of Node.js and NPM, as well as the dependencies installed in the environment (instead of being installed in the " node_modules " folder in your applications folder).
To debug a Node.js application, you can consult the Apache error log. The Apache error log file contains :
If you have manually set the PassengerLogFile value in your site's .htaccess file, the STDOUT and STDERR output and Passenger-related errors are sent to this file instead of the Apache log file.
You can also set the PassengerFriendlyErrorPages value to on in your .htaccess file to display errors relating to the start-up of your Node.js application directly on the web browser.
Possible reasons: Your Node.js application (or one of its dependencies) requires specific functionality in the C++ library, which is not currently present on the server in question. This can happen on our cPanel formulas with the CloudLinux 7 operating system (an operating system based on CentOS / RHEL 7) whereas one of your dependencies requires RHEL 8 / CentOS 8 or later.
Solution: You can open a support request to ask to be migrated to a server with a CloudLinux 8 operating system.
Possible reasons: Your process may be stopped by the server if it is running beyond the execution time and/or quantity of resources (CPU, RAM, etc.) authorised on your hosting package. You can view the process stop history using our " Logs " tool available from your cPanel interface.
Solution: You can limit the RAM memory used by npm using the NODE_OPTIONS environment variable as follows:
NODE_OPTIONS='--max-old-space-size=2048' npm install
This example shows, for example, a limit of 2048 MiB (2 GB).
Possible reasons :
Solution:
Rate this article :
3.2/5 | 14 opinion
This article was useful to you ?
Yes
No
1mn reading
How to use a Python application on cPanel hosting
1mn reading
How to use a Ruby application on cPanel hosting
Bonjour,
Merci de votre retour.
Il est tout à fait possible de déployer une application sous Angular.js sur nos formules cPanel.
Pour ce faire, rendez-vous dans sur votre cPanel et chercher : "Softaculous Apps Installer"
Puis dans la nouvelle page qui s'ouvre, rechercher dans la barre de recherche en haut à gauche "Angular". Et vous pourrez installer Angular sur votre cPanel.
Je vous remercie de votre attention et reste à votre disposition pour toute autre question ou complément d'information.
Nous vous invitons à contacter notre service support à travers votre espace client, afin de vous apporter une aide si vous rencontrez des difficultés quelconque. (https://aide.lws.fr/a/268)
Cordialement, L'équipe LWS
Bonjour,
Je vous remercie pour votre message.
Les raisons qui vous empêchent de créer ou de faire fonctionner une application Node.JS peuvent être nombreuses et nécessite d'avoir plus d'informations pour être analysé précisément.
Je vous invite à contacter notre équipe d'assistance technique depuis la rubrique "assistance" de votre espace client afin qu'un agent prenne en charge votre demande et résolve votre problème.
Cordialement, L'équipe LWS