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
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
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
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
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