After spending hours trying to debug a Critical Error on a client's WordPress site, realized that I was debugging it in the wrong place. I had SSHed into the VM on GCP while I myself had transferred that site out of GCP to my own server when it was impacted by malware. Now, I was in the GCP server seeing woah, there's malware here, trying to clean it up and then trying to debug, but nothing seemed to change anything, tried everything. Eventually decided I will move this backup stored in wp-content to my own server and then will set up a new site there and restore that backup, and it was after I had copied the backup to my own server, that I realized that site is being served from my server and not GCP's. Meh
Turns out, it was a theme issue, which got fixed by replacing theme content manually.
Then spent some time streamlining my personal site publishing workflow. Firstly, I created a proper git rep on my local device and version stored the previous versions in git. Then, I added a mechanism to push the changes live on my server (not git) by just executing ./.deploy.sh
That took some time but not much. But then spent hours trying to figure out how to set up conf on my HestiaCP server which is running apache + nginx reverse proxy, to perform the following two seemingly simple functions:-
- Serve respective html document (domain.tld/essay.html) when user visits a non.html url (domain.tld/essay) if it exists
- When user visits url with .html appended (domain.tld/essay.html), redirect to clean version (domain.tld/essay)
What I essentially wanted was a single cleaned url for every piece of content. Because it doesn't seem a good practice to have two urls serving the same content.
But it wasn't as simple as it seems, primarily because of my messy HestiaCP apache + nginx setup. I really should move to pure nginx server but I'm being lazy about that. Anyways, when I figured out it should be done in nginx conf and not apache, the issue was I couldn't edit the main conf rule because HestiaCP rebuilds it every time. So, I had to add to nginx.conf_custom, but somehow it wasn't working. Realized, they should be added in nginx.ssl.conf_custom since my site has an https redirect.
But now, one rule was working but not the other. That was because we can't add a new location tag in the custom conf which is being included from the main conf file. So, I had to use a different rule (Even though this took me much time, but thanks to LLMs, I could get the rules atleast, otherwise I would have to spend a whole day understanding rules, which I wouldn't have spent on it) for that which wasn't a / location tag.
This worked, but it broke the www to non-www redirect. Figured out that custom conf is included before the redirect conf and that is why, when a redirect rule is matched in custom conf, later rules aren't applied. So, I added that part (which hestia has separated out) in my custom conf as well, and finally I had it working.
Still, a url such as http://www.tamseel.pk/internet-companions.html is redirecting 4 times before reaching out https://tamseel.pk/internet-companions which isn't great and can obviously be fixed, but maybe that's for another day.
-----
Also, I listened some more part of Henrik's recent podcast and there was this part where he describes how the book by a mathematician, with title something like proofs and refutations, was helpful in his internalizing of this method of increasing the surface complexity of the problem - no, I guess that's not a good description. But, I thought of it like as was talking with Talha on how there are no books on how to think. This seemed to be (according to Henrik's description) a book that was indirectly about how to think.