Ubuntu Webserver Setup with Nginx

27/01/2024

Initial setup of my headless Ubuntu VPS as a webserver with Nginx

Windows Applications

I’m locally using a Windows machine. After trying various programs, here are the ones I’ve ended up using:

Helpful for connecting with SSH

Setting %Home% on Windows

In Windows (unlike in Linux), the HOME environment variable isn't set by default. Some programs that run in the command line / originally came from Linux expect HOME to exist - I set it to my user's home directory. This issue first came up when I was using ssh to connect to the server, as it expected my private key to be found at %HOME%/.ssh/id_rsa

Updating the known_hosts File

If you come across the “WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!” error when trying to ssh into the server, you need to update the known_hosts file (%HOME%/.ssh/known_hosts) on your local machine:
  1. $ ssh-keygen -R [remote host]
    Removes all keys associated with the remote server from the known_hosts file
  2. $ ssh-keyscan -t rsa [remote host] >> ~/.ssh/known_hosts
    Fetches the keys of type rsa from the server and write them to known_hosts

Tutorials that I followed

1. Initial Server Setup

- setting up a non-root user & firewall

3. Setting up Nginx (web server)

- running as a service with systemctl, setting up server blocks
🠜⭪ HOME 🠜⭪ SITEMAP