1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Install node.js on Managed Cloud Server
This guide explains how to use Node.js with a managed Cloud Server.
At the moment, Node.js is not available with ourshared web hosting .
To install Node.js via NVM:
nvm install stable
Attention version 18 is not compatible, to install the latest compatible version Infomaniak will therefore need to run the command:
nvm install 17
List available versions:
Then, to install a specific version:
Or to install the latest version:
nvm install node
Change version of Node.js, to put version 6.3.1 (or another version):
nvm alias default 6.3.1
Go to your cloud server's WebSSH console to set up NVM on your cloud server.
You need to source the .profile file:
You can then run the command:
Redirection of web traffic to a specific port
By default, on Cloud, web traffic is sent to Apache. To send requests to a Node script or another service (as long as it "listens" on a port between 4000 and 4009), you must go through HAProxy.
This applies in particular to Express servers, Socket.IO, Meteor.js, Nuxt.js, Django, Flask, Ruby on Rails, even possibly Java (J2E), etc.
To do this, you must ensure that the service is listening on a port between 4000 and 4009 (especially with
server.listen(4000) for Express or a basic Node HTTP server, but depending on the project type by other means, a configuration file, in code or otherwise) and on all interfaces (0.0.0.0). It will also be necessary to configure HAProxy as in the example below:
- Connect to your Infomaniak space (manager.infomaniak.com)
- Go to Cloud server
- Click on the cloud server concerned
- From the left side panel, click on FastInstaller
- In the list of applications, click on the iconto the far right of FastInstaller and select Configure
Configuring Node as a service
In order to configure Node as a service, we recommend using a "service systemd-user".