This article describes the operation of Node.js functionality on virtual hosting. The article is divided into 3 parts - start-up, management and basic principles of operation. In case of problems with the operation of the project on Node.js, make sure that all the basic conditions and principles described below in this article are met.
An example of launching a test project is shown in the instructions ? [link]
1) To activate the Node.js functionality, you need to go to the hosting control panel, where on the tab of the desired site, click the Edit button opposite Node JS [beta]
2) If the functionality was not activated before, the system will offer you to choose the version of Node.js on which your project will work. At this point, we recommend that you refer to your application's documentation to select the correct version. Select the version on and click the Save button.
If you did not find the version you need in the list, please contact our technical support at the address support@cityhost.net.ua from the registration mail or from the control panel.
3) After activation, you will see the Node.js functionality control panel. You will see ready-made instructions and detailed instructions on how to proceed, according to which you will be able to launch your own Node.js project.
The project is restarted and stopped using the Restart or Stop buttons.
You can completely stop the project using the Disable button. The same functionality can be used to change the version of Node.js.
After deploying the project in the root folder of the site, you need to execute the npm install
command to download all the software dependencies/modules of your project from the repositories. Without this step, the project will run with errors or simply not load.
It is important to direct your project not to a port, but to a socket. In the project files, use the global variable default.env.port
, which always refers to the correct socket.
You need to reload the project in case of making program changes to the project, for example after executing npm install
Apache/php functionality is not available on the site while the Node.js functionality is running. You can switch between Node.js and Apache/php by clicking the Disable button.
After the activation of the functionality, the files necessary for the operation of the project will be added to your hosting — the Node.js backend of the selected version and software dependencies/modules. These files are located in the .nvm
and .npm
directories in the root of the hosting.
If there is no free space/inod on the hosting OR malicious code is found on the hosting at the time of activation of the feature, the feature will not be activated until the problem is resolved.
All question categories