Installing TNG - the next generation of genealogy site building - on a VPS

Installing TNG - the next generation of genealogy site building - on a VPS
Photo by Maria Teneva / Unsplash

I previously wrote up steps for installing TNG v12 on a Vultr VPS with a domain hosted on Gandi.

Having moved to webdock and to their "perfect server" VPS offerings, the process for installing TNG v13 has not changed much (if at all), but was considerably simpler.

Provision server

Use existing or create a new VPS. The smallest SSD Nano4 for €2.5 a month is probably sufficient to start, or the next one up, SSD Bit for €5 a month has very generous specs for the price.

At time of writing the default image used was Ubuntu Jammy 22.04 with Nginx and PHP 8.1

Provisioning a VPS

Configure DNS

Once the server is provisioned and you know the IP address, set up A records for the  domain to be used. I've recently starting using porkbun, they have very competitive prices and are very easy to use.

Delete the default records and create A records as required.

Setting up DNS

Log in to the VPS

On the VPS dashboard, create a new shell user and upload or assign your SSH key. You should now be able to SSH in using your server alias e.g. ssh claire@webdock05.vps.webdock.cloud

Update any outdated packages using sudo apt update && sudo apt upgrade.

Upload TNG installation files to the server

Download the TNG zip file locally according to the instructions in the email received when purchased and upload the zip file as is to the server using scp.

scp tngfiles1312.zip claire@webdock05.vps.webdock.cloud:tngfiles1312.zip

Set up Nginx

  1. Unzip files to directory under web root: sudo unzip tngfiles1312.zip -d /var/www/furney.co
  2. Update permissions: sudo chown -R www-data:www-data /var/www/furney.co/
  3. Create nginx virtual host for the new site: sudo vi /etc/nginx/sites-available/furney.co and add the following (replace domain name) tweaked from webdock virtual host config:
server {

  root /var/www/furney.co;
  client_max_body_size 256M;

  # Add index.php to the list if you are using PHP
  index index.html index.php;

  # Which domain names will this vhost respond to
  server_name furney.co www.furney.co;

  location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
  }

  # Pass PHP scripts to FastCGI server
  location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_intercept_errors off;
    fastcgi_buffer_size 16k;
    fastcgi_buffers 4 16k;
    fastcgi_connect_timeout 600;
    fastcgi_send_timeout 600;
    fastcgi_read_timeout 600;
  }

  # Necessary for Let's Encrypt Domain Name ownership validation. Place any other deny rules after this
  location ~ /.well-known {
    allow all;
  }

  # Deny access to .htaccess or .htpasswd files
  location ~ /\.ht {
    deny all;
  }
}
  1. Symlink into sites-enabled: sudo ln -s /etc/nginx/sites-available/furney.co /etc/nginx/sites-enabled
  2. Restart nginx: sudo service nginx restart
  3. Browse to readme.html at http://furney.co/readme.html

Set up SSL

Before doing anything else set up SSL. Its super simple. Certbot can use the Nginx virtual site config to work out all the details.

sudo certbot --nginx -d furney.co -d www.furney.co

Refresh the readme.html page and it should automatically redirect to use HTTPS

Create a database

Back on the webdock dashboard, create a new database for TNG by clicking on the pencil to "Manage MySQL".

Install TNG

We're now ready to install TNG. I used to have plenty of issues with the initial file permissions steps on previous servers, but if you successfully changed the ownership of the files to www-data as instructed previously, this should work fine.

  1. Click "Set permissions" in step 3 - should complete successfully
  2. Rename the gedcom and backups folders e.g. add a random number to the end
  3. Add database details and verify the connection
  4. Create the tables
  5. Create a user
  6. Select a template (they all suck - just choose one and move on)
  7. Browse to your new site!

NOTE: there is A LOT of useful information in the install docs at the various set up steps so well worth reading through properly as you go through, especially the latter stages which I haven't mentioned here.

IMPORTANT!! Rename setup files

To ensure a malicious user cannot browse to your readme.html and start (re)configuring your site, rename the following 3 files (use different random numbers!) or just delete them completely.

mv readme.html readme_342976.html
mv ajx_tnginstall.php ajx_tnginstall_098706.php
mv appendix.html appendix_420876.html