How I Set Up Linux Web Server & Deployed My Static Site

Steps and resources necessary to set up a Linux (Ubuntu 18.04) webserver on DigitalOcean to host a simple site

How I Set Up Linux Web Server & Deployed My Static Site

Photo by Ylanite Koppens from Pexels

In this post I'm going to go through the steps I took to deploy a Linux server, make it a web server and deploy my personal site on it.

My main purpose with this exercise is to do a Linux project and learn.

I'll be using DigitalOcean as the cloud provider, but I assume these instructions can be transferred to other cloud providers, although I haven't tried it.

Creating the server and initial setup

This documentation shows how to create the server, or Droplet as DigitalOcean calls it.

I chose an Ubuntu 18.04 image, using the cheapest standard plan and no backups. I didn't see the need for the backup option at this point.

Once the server is up and running, we can start on the initial setup. These steps involve creating another user, setting up a basic firewall and enabling external access.

I would also recommend setting up SSH keys on the server.

Domain and DNS

Since I was setting up a web server in the hope of having a site deployed, I was going to need some domain, so I bought one using Namecheap. You can also buy from GoDaddy or other domain providers.

Then you can create a DNS service in DigitalOcean and then make sure that the domain registrar is pointing to the DigitalOcean nameservers.

Nginx and SSL certificate

Now we are going to make make it into a web server. We can either use Nginx or Apache, and I decided to go for Nginx. No specific reason, just to try it out.

Here we see how to install Nginx and other adjustments. And then secure it with Let's Encrypt.

"Deploying" my site

I'll admit this step is not the most professional :D but I just wanted to get my code to the server as quickly as possible to see if everything was working.

Side thought:

I'm wondering if I should set up some delivery pipeline for it. That of course might be a bit of overhead for such a small project but for the sake of learning, why not?

Ok, back to the deployment.

What I did was that I used FileZilla to move the code from my local computer to the path:

/var/www/example.com/html/index.html

on the server, where instead of example.com in the path I had the domain I bought earlier.

It worked!

Yes, it worked :) I really enjoyed this exercise, and I find it cool to be hosting my site on my Linux server.

Next steps

There are a couple of things that I want to do next, and I'll probably use this site/server as the base.

  • Linux hardening
  • Server monitoring and configuration
  • Create a release/delivery pipeline

Have you tried setting up a web server? Is there something you would do differently?

Do you have any other ideas for the next steps?


Thank you for reading.