FAQ - Support

Node js In Plesk: How To Publish Your Application.

Your Node.js application is finally finished.  Now it’s time to host the application – i.e. to deploy (publish) it.   This article will guide you through the process.

1.    Upload

Upload your complete code of the Node.js application into a domain or sub-domain you have already created on our hosting control panel (Plesk).  You can upload everything via the File Manager, FTP or connected to a Git Repository.

2.     Activate Node.js for your domain or subdomain. 

Note!  Only one Node.js application can run per domain or subdomain. To start it, navigate to your corresponding domain and then to “Node.js”

There you will find this view where we have to make some settings

The individual settings have the following meaning:

  • Node.js Version: Here we can usually select the latest version.
  • Document Root: This is the path where your application is/will be.
  • Application Mode: Here you can choose between “development” and “production”. Since we want to publish our app, we set the value to “production”.
  • Application URL: We can’t change anything here, Plesk only shows us the address where our application can be reached.
  • Application Root: Here you must select the directory where our app has the root directory.
  • Application Startup File: This is the most important file. The starting point for our program, that is the main JS file. Usually your app.js or index.js. If it is located in a subdirectory, you have to enter the following value: ./server/index.js.
  • Custom environment variables: Here you have the possibility to create environment variables for the app. These are variables that your program can read via process.env.VARIABLE. This is often used for authentication keys (JWT & Co.), express settings or database access data.

3.   Install Dependencies

Now we click on “Enable Node.js” and then on “npm-Installation” to install all dependencies from our package.json. Here our node_modules folder is automatically created in the root directory of the app.

Note:  If you get an error with "no node binary in the current PATH" this can be fixed by creating a file called ".npmrc" in the application root folder and adding "scripts-prepend-node-path=true" both with out quotes.

4.   Restart and test the app

Now your application is ready. For the application to run correctly, you should press “Restart App” again. Then test the app by clicking on the corresponding link.

 

Note: If you can't find an answer to your problem click Here to open a support ticket (requires log in).