Beget hosting provides many options for deploying projects written in different languages. In the current article, we will figure out how to deploy a project written in NuxtJS to production in SSR mode.
So, first of all, you need to enable ssh access for your account in the web server panel.
Next, connect to our hosting from the terminal
once on the server, go to docker — environment
ssh localhost -p222
Before going any further, it is assumed that you already have Python installed on your hosting. How to install I will not quote the manual, I will just leave a link to it, where everything is described in detail. In my case, it was necessary to install Python 3, which I did.
Git is already installed on the server by default, so go to the Django folder of the application, update the project with the command, of course, you first need to initiate the git repository
~/.local/bin/python3.5 ./manage.py migrate
And also copy the static:
~/.local/bin/python3.5 ./manage.py collectstatic
After completing the environment setup, you need to create a tmp directory where the restart.txt file will be stored:
Recreating tmp/restart.txt applies the new changes to the project.
That’s probably all, Very high quality and inexpensive hosting, I advise everyone!
Installing any version of nodejs on beget hosting
In order to switch between versions of nodejs on hosting, we need the NVM utility — Node Version Manager.
Connect to hosting via ssh:
Next, you need to go to the Docker virtual environment. Node.js is only run inside a Docker container. You can read more about the work of nodejs in beget in the article. To do this, after connecting via SSH, you must enter the command:
You need to install nvm from the home directory, to go to the home directory, run the command:
Now install nvm:
The current version of nvm can be found here.
After the installation is complete, the following lines should be added to the .bashrc file:
Check for their presence by displaying the contents of the .bashrc file:
If these lines are not in the file, then add them to the .bashrc file:
After the lines are added, run the command:
Trying to install the version of nodejs we need:
Welcome to ZENCOD.ru! Here you will find articles on web development, javascript, linux and other topics that may be helpful.
Creating a new NodeJS site
You can read more about setting up a site for NodeJS in this article. Here I will briefly go over the main points.
Go to the hosting control panel, open sites, create a new site. For example, I will call it node-test.
Connect via ssh.
Switch to docker with the following command:
Go to the directory of the new site
Next, create a directory for the project (for example, I’ll call it www), as well as the tmp directory inside it. We do it all with the following command:
Create a public link pointing to public_html
The directories for the site with NuxtJS are ready, now let’s move on to NuxtJS itself.
Transferring the NuxtJS SSR project to hosting
In order to run a site on NuxtJS on a hosting, we need to install nuxt-start. We add it to the project either via npm or via yarn.
i nuxt-start
nuxt-start
Project preparation completed.
Now transfer the project to the hosting directory ~/node-test/www.
Customization
Create a .htaccess file in the public_html directory with the following content:
Now go to the ~/node-test/www directory and rebuild the project:
In order for Passenger to reread the config, you need to create the tmp/restart.txt file. You need to do this in the directory specified as PassengerAppRoot in the .htaccess file earlier.
Done! Open the site in a browser and check that everything works.

