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.
Node.js is a free software platform in JavaScript geared towards network applications that need to be able to scale.
At the moment, Node.js is not available with ourshared web hosting .
As a host, Infomaniak is only an intermediary and we we will not be able to provide additional support on this subject. If necessary, you can contact one of our partners or fill out a call for tenders for free.
Install Node.js
Prerequisite
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:
nvm ls-remote
Then, to install a specific version:
nvm install
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
Source
Go to your cloud server's WebSSH console to set up NVM on your cloud server.
You need to source the .profile file:
source ~/.profile
You can then run the command:
nvm
Redirection of web traffic to a specific port
Prerequisites
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 icon
to 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".