in Dev Steps, Open Source, Servers, Web Dev

When I created my first website, back in 2010, it was nothing but a Blogger/Blogspot blog. It was a beautiful thing. With just a few clicks I would be able to set up my own blog page, with beautiful layouts (at least, I though so at the time) and write whatever I wanted, when I wanted and the way I wanted it to be written.

However, a few months later I started realizing that all that simplicity was starting to become, in fact, more of a limitation than a feature. And so I moved on to bigger and better things: so it began my relationship with self-hosted WordPress (WordPress.org).

I went into Hostgator, bought up the cheapest shared hosting plan available, made all the DNS adjustments necessary and that was it. From that day on, dealing with CPanels, nameservers, dns zoning become a frequent part of my day-to-day shenanigans.

At first I was overwhelmed with all the power in my hands. One misclick or misstep when messing around in the configs and all of my projects would be down, instantly. For weeks, it was certainly more than I could chew.

But, as time went by, I began to feel more confortable with the whole workflow and later on… frustrated. On a shared hosting, all that power that I though I had was in fact less than I was now needing for my projects. Without direct access to the machine holding my content, I couldn’t install my own scripts, optimize it for my projects or even play around with some configs without asking the web hosting company to do it for me.

It was indeed very frustrating and ended up leading to the next step in this story: migration to a VPS.

Again, as it’s happened before, I was a bit overwhelmed with all the real power in my hands, Now I really had low-level access – root access! – to all the content on my server… and I was loving it!

Yet, as always before, there came a time when I felt the need to step up and get even more control. My VPS had been set up by the hosting company and pre-packed with basically everything I needed – a web server, mysql, php and loads – loads! – of extra software, bloating my server and causing all kinds of instability in my server’s uptime.

That’s when I decided to start over fresh, with a brand new virtual server, with nothing but the OS installed.

In this post I’m going to link to all the important references I followed to setup my initial configurations and get my multi-site server up and running in just a few hours…

 

The Virtual Server

I headed over to DigitalOcean and bought myself a simple droplet without any pre-app installations or scripts.

  • Operating System: Ubuntu 18.04 (same as my desktop machine, so it made perfect sense to me)

After the first login, I proceeded to implement the initial server setup, setting up a new user (non-root) + a very basic firewall (UFW).

Choosing and installing a web server

When it came to web servers, I had 2 real options:

  • Nginx
  • Apache

Given that I’ve worked with Apache before, I chose Nginx so that I could give it a try.

When it comes to the installation and setting up of Nginx as a web server, I followed this very detailed tutorial:

Setting up LEMP

LEMP is the nginx equivalent to Apache’s LAMP and stands for (Linux + Nginx – pronounced as Engine-X – + MySQL + PHP.

The process is pretty much straightforward, following this tutorial:

Installing phpMyAdmin

Now that I had MySQL + PHP up and running, I needed an interface to interact with the DB Server.

PhpMyAdmin, being a tool I was already familiar with and very stable, was my immediate pick.

Setting up Server Blocks

Now my web server was up and running and was accessible through my main domain. But I wanted more than that. I wanted to be able to manage multiple domains inside the same server, just like most hosting solutions do, without needing to acquire multiple droplets for that.

That’s where Nginx Server Blocks come in. Working in a very similar way to Apache’s Virtual Hosts, it allows us to host multiple domains in the same server, each one with its own set of configs.

Setting up FTP Access

To agilize the process of transferring files to/from the server, I needed to install an FTP Server on the server.

I choose to install vsftpd (Very Secure File Transfer Protocol Daemon), following this tutorial has a reference:

 

Prepping up for WordPress

WordPress is the most popular CMS on the planet (and has been for decades). I still use it all the time for websites that require frequent dynamic content (just like this one).

Built around PHP and MySQL, WordPress still requires a few changes and tweaks on the server, in order for it to run smoothly and unleash its full potential:

To avoid problems with permalinks, this Stack Exchange answer might be pretty useful too.

 

 

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.