Nerdy Notes

Hosting

Digital Ocean – It costs $7.20/month (before tax) to run this website. It’s not managed hosting, but it’s secure and easy enough to learn. I’m using the smallest AMD premium droplet that they have for $6/month, and I’m paying an additional $1.20/month for automated backups.


Cloudflare – This is a must! It’s a free CDN that is the secret sauce that serves my website to the world. Without it, the performance of my website would be terrible since I’m using a small small and low resource VM at Digital Ocean. This reduces the load on my server and allows me to serve this site globally.


Jetpack – WordPress created Jetpack as a freemium service. For myself, I’m using it in conjunction with Cloudflare to speed up and serve my site from multiple servers. This takes the pressure off of my inexpensive server, provides for a faster and more stable site, and is available for free. Automatic (the creators of WordPress) would ultimately like you to upgrade to one of their paid services like daily backups, but the free version of Jetpack is definitely work checking out.

It also syncs wonderfully with Google Photos where I backup all my photography. Using Jetpack, I can import directly from Google Photos. During the process, the photos are copied to the WordPress media library, resized to approximately 4K resolution, and optimized. All posts from 8/17/2021 and going forward will be served in that high of resolution.

Furthermore, the gallery and lightbox included with Jetpack rivals and surpasses many commercially available options.

Lastly, it also provides analytics and helps improve SEO – no need for additional plugins.


Plugins

Akismet Anti-Spam: It’s free and blocks spammers. I haven’t had any issues with it at all.


Disable Generate Thumbnails: This is probably the most controversial section of this page. WordPress and themes generate a ridiculous amount of lower resolution images for everything from thumbnails to the media gallery to any and all images displayed on a web page. While this makes very good sense for reducing page load times, it has many disadvantages too:

  1. Lowers the quality fo the images displayed – horrible on a photography blog like this one.
  2. Creates thousands of images that are never used.
  3. Wastes tons of precious server space.

The three thumbnails I have created are the default WordPress ones that you see unchecked below. The “thumbnail” and “medium” settings are used for the media library preview, and the “large” setting is used for thumbnail images in galleries. By unchecking the other larger options, when an image in a gallery is clicked, it’ll be served in 4K. Some might argue that’s too large for a website and takes up too much space and bandwidth. However, now with 8K becoming a thing on YouTube and 4K being everywhere. A handful of images on a website in 4K won’t take up too much bandwidth nowadays.

I have no idea what the bottom two functions do, but I leave them enabled.

Justified Image Grid (JIG): This is the photo gallery plugin I use all over this site prior to 8/17/2021. Going forward, I would just recommend Jetpack.

Old information prior to 8/17/21…. JIG creates high quality thumbnails for galleries in its own cache separate from the default WordPress thumbnails – hence why I use the above referenced Disable Generate Thumbnails plugin. JIG has PhotoSwipe as an option (the best lightbox ever). One really awesome aspect of it, is that it’s a one time purchase of $27.


WPvivid Backup Plugin: This is a free plugin that backs up my WordPress to Google Drive. I mainly use this for a secondary backup – just in case something happens with Digital Ocean or my installation completely gets corrupted.


Miscellaneous

In order to get Jetpack working on a fresh WordPress / Ubuntu 20.04 droplet install from Digital Ocean, I scoured the web looking for answers. There’s some stuff you need to install, some stuff to disable, and then it’ll work. Along the way, you need install some other stuff and add a swap file to make your underpowered server run as efficiently as possible.

The following commands are roughly what I did in order to restore my site from a WPVivid Backup that I created elsewhere before moving to Digital Ocean.

sudo apt-get update

sudo apt-get install php-xml

sudo a2disconf block-xmlrpc
sudo systemctl reload apache2

sudo apt install php-imagick

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade
sudo apt autoremove


Swap file instructions abbreviated from https://bitlaunch.io/blog/how-to-create-and-adjust-swap-space-in-ubuntu-20-04/

cd ..  (as many times as necessary to get to the root)
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.vfs_cache_pressure=50

To make the change permanent, add the vm.vfs_cache_pressure=50 to the bottom of your sysctl.conf with:
sudo nano /etc/sysctl.conf

Reboot

sudo nano /etc/php/8.0/apache2/php.ini

Under resource limits:

1 and 2) change max_execution_time and max_input_time to 3600
3) memory_limit to 512M

Under Data Handling 
Change post_max_size to 2000M

Under File Uploads
upload_max_filesize set to 1000M

Reboot

Restore from wpvivid (already uploaded)

Activate stuff