A random start

Roll the dices...
Photo by Ugo Mendes Donelli / Unsplash

I am an insomniac guy. That night, I was trying to learn Linux commands and CI/CD, and succeeded in neither. A thought popped up in my head: buying a server and messing with it would solve my problem.

I got out of my bed, and bought a VPS, and then I realized that the IP looks ugly. The need for a nice name arose, so I went ahead to buy a domain. It was quite cheap, but the process after that was kind of annoying (I had to "register" the domain with my name, and my phone, and my address).

The day after, while I was waiting for the completion of the transaction, I messed around with the server. I tried to upgrade it from Ubuntu 14 to Ubuntu 16, but then gave up at the second failure.

The idea of blogging popped up in my head. After a few Google searches, I found Ghost. I am a coder myself, and had abstract ideas on how stuff work in a server. Thus, the journey started.

Technical frustrations

Feeling frustrated
Photo by Steve Johnson / Unsplash

I found out Ghost use NodeJS, so I installed the latest version of NodeJS, only to discovered later that Ghost only works for earlier versions of NodeJS. After a few Google searches, I turned to NVM (Node Version Manager). I was finally able to set Ghost CLI up. I tried to install an instance of Ghost, but there were some problem with ghost start. I realized that I was using CentOS from my friend recommendation, and it was not something that Ghost likes. I gave up and came back to Ubuntu 14, only later learned that the OS does not matter that much.

Back to Ubuntu and read the installation document again, it bothered me a little since Ghost wanted me to use Ubuntu 16 or Ubuntu 18. I failed to upgrade Ubuntu 14 to 16 two times, and I did not want to waste my time again. I sighed, and continued working on the hope that it would not be a problem. Setting up Ghost CLI again was easy because I had the experience. After a few hours, I was done installing Ghost, and tried starting it again.

Some issues arose with permissions even though I followed the steps on the documentation. It took me a few hours to read about chown and chmod, and to use those commands correctly. I succeeded as ghost doctor did not tell me any problem on permissions, but other arose. I could do ghost run, but could not do ghost start. Reading the log told me something on NodeJS's process creating problem. I made a futile effort on deleting the installment folder and create it again.

I almost gave up, but I realized that there was a command called ghost install local. I ran the command, and ghost start worked. Then, I knew I must somehow let outside see my "local" blog. I turned to Apache, and UFW, and nginx, and by some "magic", I finally see my blog on port 2368 of my server.

I was happy that my journey was coming to an end. There was an email for me that my domain works. I vaguely know that I need to "forward" the domain to my server.

Messing up with domain DNS was not hard, and I succeeded routing the domain to my IP, but the forwarding only allows port 80. That port was showing a template web page of nginx. I must go back to my server, and try to forward port 80 to my local blog at port 2368 somehow. I found a tutorial on how to do it. I copied the code, but it did not work. nginx gave me 502. Later, I made it work by changing the configuration file of Ghost. It was hostname or something. Pasting the server's IP on the browser address bar gave me the blog. Open my domain again, and it also showed the blog.

I am happy that I made it and you made it here. Congratulation.

What I have learned

Feynman the physicist taught us the idea that you do not understand things until you are able to teach them to others. Someone else told me that writing is the same — you only truly understand a vague idea, and make it concrete if you can put the words on a paper (or on a text editor). I was good in neither, but blogging would change it, I hope.

On how a website works in general

We only need to understand the two terms:

  • Server: one who serves, often has an "ugly" name that includes numbers only.
  • Domain: one that has a pretty name.

When we type a name on your browser address bar (like thanhnguyen2187.xyz), it is the domain. The domain should be "linked" to a server, to response content to our request. How it is linked, or how the server response, or how to resolve the domain names are outside of my understanding right now.

On being a "System Administrator"

We need to understand that computers has operating systems. Windows is the most popular for casual users. Linux is one for more technical-oriented people. Linux has a lot of variations, but they often have the same tools. Linux is often be used on servers, since they are "lighter" and cheaper than Windows. A few essential tools and commands that you need to know are:

  • Google: to ask questions (the right ones hopefully).
  • ssh: to connect to servers remotely.
  • vi or vim or nano: text editors.
  • cd: shorthand for "change directory".
  • sudo: shorthand for "superuser do", to run commands as administrator.