Moving from python to Java/C++ is like…

So I’m changing job and I will use Java/C++ mostly in my new job. And here is the counter to add every time I forget to put a semicolon.

6

Missed Semicolons

New Website Setup – Part II

Part I

In Part I we have setup web hosting for multisite wordpress for blogs. In this part we will setup email hosting.

In old days where VPS hosting with cPanel is main stream, we don’t need email hosting at all as they are usually provided together in bundle. But now I need to look for email hosting for customised domains. The most popular ones are – of course giants like google workspace and MS office 365 (for business). They are, however, more than just email hosting but more like whole business app suite. There are some popular email hosting too like ZohoMail, but the charge is still quite high. All I need is a simple mail hosting allow me to have email on my own domains, and then I will use my Gmail to fetch them and delete from server. In this case storage is not a concern either.

In the end I found out my domain registrar namecheap provides private mail hosting too, and with a very good price. As of written, the cheapest tier is only $0.84 per month, with any additional mailbox at $0.41 per month. So I signed up from here.

Once signed up, there are some very nice guide documents on welcome emails. A few things to setup here:

DNS Records

This can be found in welcome email, or follow the link https://www.namecheap.com/support/knowledgebase/article.aspx/1340/2176/namecheap-private-email-records-for-domains-with-thirdparty-dns/ to setup on Lightsail.

The only issue I had encountered is with DKIM key as there is 255 text length limit on lightsail. However this is not a problem, simply put a new line break (Enter key) in between DKIM value to make each line below 255 text. And once setup is done this can be verified from https://mxtoolbox.com/dkim.aspx to make sure the value is valid.

Gmail Fetcher/Desktop/Mobile setup

Again this is in welcome email or can be found on https://www.namecheap.com/support/knowledgebase/subcategory/2175/private-email-client-setup/

WordPress SMTP plugin

WordPress has its SMTP plugin (WP Mail SMTP) installed by default. Just need to enable it and follow setup from previous section and that’s it.

New Website Setup – Part I

Part II

So first thing is to determine a web hosting provider.

Since I have my own domains, immediately I just need to get a few things here.

  1. web hosting for wordpress blog
  2. email hosting for using my domains

I could find another cheap web hosting again from WHT forum providing both wordpress hosting and email (usually unlimited, bounded by host) but worried that it may just become another downtownhost in future. And with cPanel as well as Softaculous getting greedy it seems VPS web hosting is no longer a popular option.

So I started to search for cloud solution. The 2 popular ones – AWS and Google cloud. Both are decent and flexible – but all I need is just a simple hosting – so in the end I chose AWS Lightsail – which provides a package install for wordpress (built by bitnami), and also it’s cheapest.

I have more than one domains also used to have multiple WP blogs – so the wordpress multisite is a no brainer for me.

Create a wordpress multisite instance is easy, just follow the steps on lightsail website: https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tutorial-launching-and-configuring-wordpress
Only one thing – I choose multisite version instance instead of normal wordpress.

You will need static IP, DNS setup, update DNS record on your domain registrar (namecheap/namesilo for me). Once setup is done, there is a few other steps to follow:

Enable HTTPS

Not a must – but any good website should have it. Follow the guide on https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-enabling-https-on-wordpress
One thing to note – HTTP to HTTPS redirect is not auto setup by bncert tool – so need to manually change bitnami conf. Follow https://docs.bitnami.com/aws/apps/wordpress/administration/force-https-apache/. Importantly we need to change -vhost.conf file too.

Since we use multisite wordpress – we need to use slightly different config to allow HTTPS redirect for individual domains. This is described in https://community.bitnami.com/t/force-https-for-individual-domains-within-wp-multisite/85658

So in the end, I have updated 2 files (the SSL config file is not needed as it’s already on port 443).

  1. /opt/bitnami/apache2/conf/bitnami/bitnami.conf
  2. /opt/bitnami/apache2/conf/vhosts/wordpress-https-vhost.conf

With changes like below (highlighted are added lines).

<VirtualHost 127.0.0.1:80 _default_:80>
  ServerAlias *
  DocumentRoot /opt/bitnami/wordpress
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
  RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [R,L]
  ......

Update primary domain

For multisite wordpress, there is one extra step to update its primary domain. Otherwise you will see it changes URL to IP address. This needs to be done from command line too: https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-define-the-primary-domain-for-your-wordpress-multisite

Setup additional blogs for other domains

I haven’t done this step yet – but this can be done by following https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-add-blogs-as-domains-to-your-wordpress-multisite