Showing posts with label external access. Show all posts
Showing posts with label external access. Show all posts

WordPress installation on Synology box

For the past few days I have been struggling to install WordPress (manually, rather than using the Synology Wordpress package, so that I can have multiple sites) on my Synology 216-Play box, and hit many problems which I have managed to work my way through (or round) using tips from various internet forums, and the excellent musings of 'Sridhar' on his blog https://sridhar.blog/install-multiple-wordpress-sites-synology-nas/

He admits that his blog does not tackle the problem of access from outside your local network, which I was keen to do, so what follows is a combination of Sridhar's suggestions along with some of my own which together seem to work.

I don't guarantee that they will work for you, but I hope they might give you some help if ever you want to try the same.

There were quite a few unforeseen problems along the way, many down to the odd quirks in the Synology software, so if you want to read my solutions to those, please read the following posts which will appear shortly.

Many thanks,

Robert Eadie

Problems along the way

Firstly, the various problems I came up against.

  • Whatever I tried, I kept on getting Server 500 errors whatever I tried at the WordPress installation.
    • Most suggestions are to try 'localhost' or 127.0.0.1 as the hostname of your database (assuming it is on the Synology box).
    • The only thing that worked for me using MarioDB 10,  was 'localhost:/run/mysqld/mysqld10.sock'
    • Many thanks to whose comments on Sridhar's musings got me past that barrier.
  • Wordpress itself needs direct FTP access to each of your sites, if you ever want to install new Themes, or plugins, or . . .
    • That means that each site needs a separate user, and each of those users needs direct FTP access to the wordpress folder for that site.
  • Synology does not make it easy (or even possible) to create a shared SUB-folder, nor to point web site root to a user home folder (which would have been easier).
    • That resulted in my deciding to create a new shared folder (at the top level) to hold the wordpress software for each of my sites.
  • You will of course need to access your Internet Router and setup 'Port Forwarding' both 80/443 for web traffic, and 21 for FTP, to your Synology box.  I have a BT Home Hub on which it is very straightforward, but see my detailed post shortly!

External access to your web site on Synology

Your Synology box probably has an Internal IP address which can only be accessed from machines on your internal network.  If you want access from external devices, anywhere on the Internet, then you need to 'map' the external IP address of your Router to the Internal address of your Synology.  You also need to map a 'nice' hostname (e.g. eadie.ddns.net) to that external IP address, so that users don't have to remember an IP address.

Mapping an External IP to and Internal IP address.

This is normally referred to as 'port forwarding' and needs to be set up on your router.  You need to set up port 80 (for http) and if required 443 (for https).  Also, if you want to be able to install new Themes and Plugins, and update them, once you have Wordpress installed, you will need port 21 for FTP.  I can't go into all the details for every router, but on my BT Home Hub 5 it was fairly obvious from the Admin - Advanced menus.  (Check your router manual!).

Mapping a hostname to your external IP address.

This is known as setting up a DNS record, pointing your nice hostname (e.g. eadie.ddns.net, or your own personal domain) to an IP address.
The first problem is that most domestic broadband connections do not keep the same external IP address for ever, as your ISP can change it (at their convenience) from time to time.  If this applies to you, then you have two options:
  • Buy a fixed IP address (from your ISP), or
  • If you're like me and are trying to do thing 'for free' (which is why I'm trying to set up my website on my Synology, so that I don't pay for hosting) then you need to set up a 'Dynamic DNS system' which will constantly keep track of your external IP address, and change the DNS setting as the IP address changes.

Dynamic DNS (DDNS)

There are several Free Dynamic DNS providers, and I have tried a few, such as NoIP, DtDNS, FreeDNS, etc.  They offer slightly different services (for free), but you will also have to set up on an internal machine, an automatic system which will constantly tell them what your external IP address is.  You can do this on:
  • Your PC or MAC,
    • This will of course only work while your computer is on, so if your IP address changes overnight, that won't be flagged up until the next morning, or if you go away for several days and switch your computer off . . . .
  • Your Synology box,
    • Seems ideal, except that the Synology software (for some strange reason) only allows ONE URL/hostname for each DDNS provider you use.  So if you want four websites/hostnames, you will need to register with four DDNS providers.
    • (I have no idea why this limitation is built into my Synology box, and I may have done something wrong, but . . .)
  • Your router.
    • This seems the ideal, as most people's router is on 24/7, but on my BT Home Hub, I can only use ONE DDNS provider, so if I hit the limit of their maximum hostnames for their free service, I can't add more from another provider.
    • This limitation and the Synology limitation conspire to make things more awkward than they ought to be (but we're here to try to overcome these problems!).  At the moment, for testing purposes, I have three (from the same provider) set up on my router, and two (from two different providers) on my Synology.  If you want to go much beyond that, I suggest you start paying for your DDNS!
Again, setting up on the Synology (Control Panel - External Access - DDNS) or your Router is fairly straightforward.  You will need to enter your login details for the DDNS provider, and the hostname(s) you've chosen.  Both should show you whether they are successfully working.