server_configuration

Server Configuration - Virtual Host

For the hosting of this wiki, my blog Rows Across The Lake and other things, I have a VM web host. Inspired by my migration efforts, I'm documenting the changes and challenges for next time.

Some useful notes from the first server are hidden away under initial_setup (access limited for security reasons).

Hosting Provider

The host I chose to use is use DigitalOcean I've been using them for some years and I'm very happy with the service and pricing. They have many options and allow you to scale to your requirements including hosting in many geographic locations.

Note: The link above is my Referral link, If you sign up using it we both win! Everyone I refer gets $100 in credit over 60 days. Once they’ve spent $25 with DigitalOcean, I'll get $25.

Detail Pages

Server Migration

The original server was an older Ubuntu box, overdue to migrate.

Aim: Create a new Ubuntu Instance & migrate existing droplet data (WordPress) to it: https://datablog.roman-halliday.com/

Options were:

  1. Create a new droplet (VM) and migrate site(s) and services:
    1. DigitalOcean Community Documentation: How To Migrate to a New Linux Server
    2. Start from scratch, build fresh without so much history/rubbish in the background
    3. So time consuming!
  2. Upgrade server in place
    1. Why didn't I try this! It would have saved me a lot of time!
    2. Alternative… might have saved me hours!
    3. Didn't try
    4. Some advice suggested that the droplet might not have upgraded cleanly
    5. DigitalOcean Community Documentation: How To Upgrade to Ubuntu 20.04 Focal Fossa

I wanted to migrate the PI so I didn't have to make DNS changes, and so that I could quickly and easily switch between servers. But it wasn't to be:

So instead I had to make DNS changes, pointing the names to the new IPs. First prep step is to manage the Time To Live for DNS records. My TTL recommended times:

   60 seconds =  1 min   : Day and Time of migration
 3600 seconds =  1 hour  : Day(s) before migration
86400 seconds = 24 hours : Good operational normal

Following advice from:

# System version
uname -r
uname -m
 
# Services & If they are running
service --status-all
#Firewall
ufw status
ufw status verbose
 
# More
service --status-all | more
Blessed are the paranoid for they test their backups

Yes I can SFTP etc… between droplets/environments, but this also serves as a backup for some time.

Saving time (haha) by using a WordPress preconfigured droplet:

As root

# create a user for me
adduser david
 
# Add my user to sudo
groupadd david sudo
# Update
sudo apt-get update && sudo apt-get upgrade

Basic SFTP was already available/configured in the box.

Worth looking at more detailed notes on my firewall configuration.

The firewall is already configured by DigitalOcean in my choice of droplet (Ubuntu 20.04 with WordPress). However if other services are to be added (in my case yes) the Ubuntu firewall needs to be configured. See below for some extra documentation links I referred to:

In general, follow scripts/prompts when first SSH into droplet.

See apache for all details. By default for one WordPress instance, with no other sites or clever stuff, no other changes need to be made.

All-in-One WP Migration

This worked amazingly:

I had to make a change:

The two values need to be larger than the file size post_max_size and upload_max_filesize.

In the interface, the value which is shown as the “Maximum upload” is (for some reason) post_max_size.

Edit the .htaccess file, under: /var/www/roman-halliday.com/datablog

.htaccess
php_value upload_max_filesize 256M
php_value post_max_size 200M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300

After upload, it' possible to delete/rename this file to reset settings to default.

WordPress is requiring FTP credentials before installing plugin

Modify file: wp-config.php to have the line:

define('FS_METHOD','direct');
chown -R ../ www-data:www-data /var/www

Duplicator

# Mount (if not already)
mount -o discard,defaults,noatime /dev/disk/by-id/scsi-0DO_Volume_volume-lon1-01 /mnt/volume_lon1_01
 
# Create Target
mkdir -p /var/www/roman-halliday.com/
cd /var/www/roman-halliday.com/
 
# Copy to Target
cp -R /mnt/volume_lon1_01/disk_backup/var/www/roman-halliday.com/romanian .
cp -R /mnt/volume_lon1_01/disk_backup/var/www/roman-halliday.com/wiki .
 
# Fix permissions:
chown -R ../ www-data:www-data /var/www

Bulk To sort

Other Stuff (cover fast, future blog post)
- Wiki(s)
- Mailbox
- Firewall
- Hostname -- https://www.cyberciti.biz/faq/ubuntu-change-hostname-command

Notes for screen recording

Tips for OBS Studio, note aiming for things to look good in 1080p.

Check/visualise how many columns in putty output:

for n in {1..8}; do for i in {1..10}; do echo -n ${i: -1}; done; done; echo ""
for i in {1..80}; do echo -n '#'; done; echo ''
for i in {1..100}; do echo -n '#'; done; echo ''
PuTTY
- Font 20px
- Log: C:\Users\david\Documents\Hosting\PUtty Logs\

Windows Taskbar settings (so it's not shown in screen being recorded):
- Lock taskbar: Off
- Show taskbar on all displays: Off
- Move to other screen
  • server_configuration.txt
  • Last modified: 2021/04/14 08:59
  • by david