Finally setup my own wordpress website on a VPS [0/1]

This is an account of what I remember while setting up a wordpress website on my VPS.

WordPress is a database driven CMS that (in my case?) is run off a MySQL database and on a MariaDB server (in my case). Nginx functions as the web server.

No specific reason behind choosing nginx over apache (LAMP), other than a vague recollection that nginx is ‘lightweight’ and hence will (probably) not tax my poor VPS.

Essentially, I have setup a LEMP stack on my VPS. Linode’s docs have good instructions, and was heavily relied on.

One quirk was that I had PHP7.3 installed on my debian machine. It was a while before realisation dawned that a (older) version number is baked into the configuration and the instructions on Linode, and I had not been paying attention.

  • Installing nginx is as simple as apt install nginx on Debian/Ubuntu.

The next steps involved creating a database, a user and assigning right for modification of the file. While creating the database, mysql_secure_installation can be used to setup security options.

  • Several mistakes were made here and it was instructive to refresh my memory of SQL commands to correct them. For example, I forgot the username/password of the wordpress db in my ‘blitz’.
    • After logging into mysql as the root user, use the command show databases to find the list of databases.
sudo mysql -u root

If my database is named wp01, I can login to it using

sudo mysql wp01 -u root

After my initial debacle, I needed to delete the existing wordpress database and start fresh. To delete a database, use the command drop, and it applies to users as well. drop == delete.

diana_coman | yes, it is this “mp-wp” – essentially a customised, frozen version (most customizations were done by Mircea Popescu, not by me); it was genesised and it could do with some themes for it + any amount of reducing the code base for sure:

http://btcbase.org/patches?patchset=mp-wp&search=

  • [2019-07-23 Tue] : I need to check out the logs systematically and in more detail. I may need SSH access to the WP installation on younghands.club to investigate the reason behind it being slow.

Overall, the process was never ‘smooth sailing’, despite a lot of instructions being available. Several careless mistakes were made in the configuration of the URL and etc. UFW.

UFW is actually quite convenient to setup a basic firewall. The commands felt intuitive and rather simple for basic tasks. Alternatively, the firewall can be managed using iptables, which is more commonly available across platforms.

I enabled port 80, and HTTP/TCP connections, because earlier, I had closed all the incoming / outgoing connections as a default basis. Once this was done, the basic nginx index.html was available at the IP.

At this point, I still had Cloudflare as a reverse proxy / CDN. One ready convenience through hooking up with cloudfare was getting SSL setup with HTTPS access. However, it did take some doing: adding the A record in the DNS of namecheap, using the address as just ‘s’, and then pointing my server’s IP to the address.

In this case, a subdomain of the domain purchased, ragavan.co was mapped. The idea was to be able to eventually run multiple websites / processes off the server. On Namecheap, hooking an IP to a subdomain is as simple as adding an A record in the advanced DNS tab.

I recall reading something on about TMRS not using DNS anymore. I wonder what that was about. I’ve not even touched upon DNS and what it does yet… Maybe won’t have to ???? Unlikely.

Parting Thoughts + Review

Success (?)

  • Note taken on [2019-07-23 Tue 12:22]
    To a decent extent I guess. The small wins are not ‘unimportant’, and I’m just getting started.
  • I wanted my own website and blog and server, a LONG time ago. Atleast 6 years ago.
    • My intuition, based on whatever I understood at the time was that I wanted complete control over my stuff. Today, I actually feel like I know the broad outlines of all that has been done, and I could repeat it without digging through the whole thing.

      I’ve not been idle over 6 years. There was a half-baked attempt earlier in setting up self-hosted wordpress. Don’t even remember If I made it. I’ve also explored Tiddlywiki, Weebly, Jekyll and finally settled on using Hugo, before switching to WordPress.

  • Learnt the basics of how I could setup / manipulate a firewall using UFW.
  • Finally setup a LEMP stack, and actually feel like I’ve made progress in understanding what it is about.

Areas of improvement

  • I’ve recorded this mostly after the process, which was really a blur, with too many browser tabs open and too many things being tried at once in rapid-fire mode. That makes it very hard to capture useful notes.
  • Ideally, I’ve prefered to capture code and notes in Org mode documents, which can be re-run and upgraded easily at any time in the future. In this case, there are bits and pieces spread all over the place and a lot was done ad-hoc and never recorded.
  • Either :
    • I need to slow down and systematically approach things, making sure that most (if not each decision) is made with cognizance, and resist following tutorials like a blind man. Remember that tutorials / articles are not infallible.
    • I’m thinking that during these rapid fire sessions, I should conscientiously switch to hand written notes, and then re-consolidate them at the end of the day into my digital notebook. This will also serve as a revision, and make for cleaner notes.
  • At times, I’ve tried to stop myself saying that only a few of these topics are important for me to know in depth. This may be true and while general learning is good, it is also important to focus on some areas. A worthy compromise may be pushing for a logical basis for as many decisions as possible.

One response on “Finally setup my own wordpress website on a VPS [0/1]”

Leave a Reply

Your email address will not be published. Required fields are marked *