Menu

Deploy your app to a VPS with Docker, Nginx, and SSL
📰

Deploy your app to a VPS with Docker, Nginx, and SSL

DEV Community: docker·Vladimir Vovk·14 days ago
#4TN3R8yy
#devtodocker#devto#dev#docker#enter
Reading 0:00
15s threshold

Update VPS

We will need a Debian/Ubuntu VPS. First, let's connect to our server.

ssh root@server-ip-address # E.g., ssh [email protected]

Enter fullscreen mode

Exit fullscreen mode

And update the system.

apt update && apt -y upgrade

Enter fullscreen mode

Exit fullscreen mode

SSH-key login

Now let's create a separate deploy user to run our app (using the root superuser is not the best idea).

adduser deploy usermod -aG sudo deploy

Enter fullscreen mode

Exit fullscreen mode

A more secure way to log in to a server is using an SSH key. Let's create one on the "local" machine.

cd ~/.ssh ssh-keygen -t ed25519 -f vps-key

Enter fullscreen mode

Exit fullscreen mode

And copy it to the server (use brew install ssh-copy-id to install ssh-copy-id on Mac).

ssh-copy-id -i vps-key deploy@server-ip-address

Enter fullscreen mode

Exit fullscreen mode

Check that we can log in with the SSH key.

ssh -i ~/.ssh/vps-key deploy@server-ip-address

Enter fullscreen mode

Exit fullscreen mode

Next, let's disable root…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.