Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Change the configuration of a Node.js site

This guide explains how to adjust the configuration of a Node.js site hosted on the Infomaniak infrastructure to adapt the behavior of your application according to its evolution, its dependencies, or your technical preferences.

 

Prerequisites

  • Install a Node.js site on your hosting.
  • Test your modifications locally before applying them to production.
  • Check that your scripts (start, build) are well defined in your package.json file.
  • If you modify the structure of your project, remember to adjust the execution folder and the associated commands.
  • The listening port defined in the Manager must correspond to the one used in the application code.

 

Access the configuration

Each site has a dedicated dashboard to control the application (start, stop, restart), view the execution console, manage Node.js versions, configure domains, and activate SSL certificates:

  1. Click here to access the management of your site on the Infomaniak Manager (need help?).
  2. Click directly on the name assigned to the site concerned.
  3. You can open the console, stop the project (a maintenance page will be applied) or restart it.
  4. Click on Manage under Advanced settings:
  5. Click on the Node.js tab to access the settings:

 

Apply the changes

To do this:

  1. Save the changes from the Manager interface.
  2. Restart your application for the changes to take effect.

Refer to this other guide if you encounter any issues.

 

Main commands

 

Execution folder

The execution folder indicates the location on the server where the build and launch commands will be executed. It must point to the root directory of your application, i.e., where your package.json file is located.

For example, you can specify for the project root:

./

or if your application is in a subfolder named app:

./app

or if it is located in a backend folder:

./backend

 

Build command (optional)

If your Node.js application requires a compilation step before execution, provide a build command in the designated field. This command will be executed automatically before the application starts.

For example, you can specify:

npm install && npm run build

or, if you are using yarn :

yarn install && yarn build

If your project does not require any compilation, this field can be left empty.

 

Launch command

The launch command corresponds to the instruction used to start your application. It must be the same as the one you use locally to run the project.

For example, you can specify:

node index.js
npm start

or

yarn start

This command should allow you to start the server or the entry point of your application as defined in your development environment.

 

Listening port

Your application must listen on a specific port that is defined in the Manager. This port is passed to your application via an environment variable PORT.
Example in your Node.js code:

const port = process.env.PORT || 8080;
app.listen(port, () => {
  console.log(`Application lancée sur le port ${port}`);
});

Make sure this port is properly taken into account in your code.

 

Node.js version

You can select the version of Node.js that your site should use. It is recommended to use a stable version and always supported to ensure the security and compatibility of your application.


Has this FAQ been helpful?