Topics Map > Communication and collaboration > cPanel web hosting
cPanel, How to Host a NodeJS Application
Putting your application on the server
Before you can configure your NodeJS application, you need to get the files to the server. After logging into your cPanel dashboard at https://web.illinois.edu, you can transfer the files by:
- Using the Upload utility in the File Manager
- Using SFTP - see cPanel, SSH, SCP, and SFTP access
- Using Git Version Control - see cPanel, Git integration with cPanel
Application Configuration
Once your files are in place on the server, you can configure it to launch. From your cPanel dashboard:
- Under the Software section, select Setup Node.js App.
- Under Create Application, choose Development or Production.
(Development has less caching and more logging. Production has more caching and less logging.) - Enter the Application root (the directory where you put the application).
- Enter the Application startup file.
- You can add environment variables using the Add Variable button.
- Once you've saved your application, resolve its package dependencies. You can do this automatically or manually.
- The NPM package manager does this automatically based on the package.json file packaged with the application, so all that youll need to do is click on the NPM Install button.
- If you are familiar with the command line, you can follow the instructions at the top of the page to gain access to the npm and node commands to make additional changes manually, allowing for a great deal of customization.
Application Deployment
Once you have the application configured and the modules installed you can launch it by clicking the Run JS Script on the same page where you configured the application. This executes the application startup file that you defined during setup.
As Node.js applications have several different options, this can bring up another menu with different options to select depending on the application that youre running. In general, youll want to select the Start option next.
Finally, you can select the Open option to visit your page, and see your application!
Troubleshooting