Building the blog (my first web server!)
This blog you're looking at right now is my very first time setting up a web server, and boy was that an adventure! I spent a lot of the past week working on setting it all up. Under the hood, it's a Digital Ocean droplet running the Ghost CMS on Ubuntu.
I have to say, it was pretty challenging. I had to destroy and rebuild my droplet three times thanks to various errors! (including one that was just due to my laptop randomly freezing up and disconnecting halfway through the setup process ughhh)
It would have been a lot easier I'm sure if I were just hosting a static website; there would have been a lot less to configure. But then, I wouldn't have bothered to pay for a VPS (virtual private server) like this if all I needed to host was a static website, since you can already do that for free on services like Netlify without having to mess with server configuration.
Instead, Ghost is a CMS (content management system--like Wordpress) that lets you create a blog where people can sign up as members or even as paying subscribers (using Stripe for payment processing), and it lets you make different content available to different viewers based on their membership status. It uses the MySQL database to store the content and member data, and uses the Node back end to dynamically choose which content to show to each viewer, as well as to run the admin app where I can manage my posts without code.
So if I'm still learning web dev, why did I choose a CMS like Ghost instead of hand-coding a static site (like I did for my homepage), or at least using a static site generator? Well, I knew from experience that hand-coding a blog was out of the question because it just takes too much time and effort to update it, and that would cause me to use it less. Static site generators seem really cool, and I definitely want to try one later... but in this case, I specifically wanted a Patreon-like blog that people can subscribe to in order to get exclusive content. And serving different content to different visitors means I would need a dynamic site instead of a static one.
Here's my setup:
- Ubuntu 22.04 server
- Node.js back end
- MySQL database
- Nginx... I still don't understand what exactly that's for/what purpose it serves though; I just followed the requirements outlined by Ghost
- Ghost app
I tried the manual installation first (which means installing each of those above components one by one), and it seemed to work, but then I ran into errors running the Ghost app itself. So then I fell back on using Digital Ocean's 1-click Ghost installer. I still ran into an error where the installer's MySQL configuration failed and I had to set up that part manually, but it ended up working better overall, I guess!
Now that I know a little about setting up a web server, I'm even more excited for my future project of running a Nextcloud server on a Raspberry Pi!
If you're interested in learning to set up web servers, go ahead and ask me any questions about it! On the other hand, if you have more experience than me, please correct me about anything I explained wrong hahaha. (or explain for me what Nginx does!)
Cross-posted to Codedex.io