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.
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 Yves Lacroix 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!
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!
- Install Synology packages
- Prepare Wordpress software
- Create user and folder
- Setup external http and ftp access
- Create Database
- Setup Wordpress using Web Station
- Initialise and test!
Install Synology packages
Prepare Wordpress software
- Using File Station create a folder on your site for the latest Wordpress package, call it something like ‘Wordpress Software’. Keep this software ‘unused’ so it is available to start building any other new sites you want.
Download the latest Wordpress version, unpack it, and copy the contents into this new folder (there should be three folders, ‘wp-admin, wp-content, wp-includes, and several files mostly php files). There are two methods of doing this:
Install the Download Station on your Synology, set its destination folder as your new folder for the software, and download from http://wordpress.org/latest.zip, then unpack on the Synology using the context menu for the zip file, or
Download to your PC, unpack, and upload the contents up to the folder using File Station or an ftp client such as WinSCP. (I found problems uploading folder using Filestation, and didn’t want to use ftp, so used option 1 above.)
Use File Station to copy all this software (3 folders and files) into the folder ‘test’ you created above.
Create User and Folder
New user ‘test’
New shared folder ‘test’
Give ‘test’ and ‘http’ read/write permissions to test folder
Using Control Panel – File Services – ftp
- Enable FTP, and
- under advanced – direct user ‘test’ ftp root to shared folder ‘test’.
Setup external http and ftp access through your router
- Setup DDNS on Synology.
- Register with one of the (free) DDNS services (‘No-ip’ in my case)
- eadietest.ddns.net = 89.1235.110.79
- On your Synology Control Panel – External Access – DDNS
- Add your new DDNS service provider, hostname, login details, and external (router) IP
- Setup ‘Port Forwarding’ on your router
- Usually ports 80 and 443 incoming, route to the INTERNAL Ip address of your Synology box
- Create a new database for your site, eg ‘test’
- If you don’t want to use ‘root’ for Wordpress to connect to this new database, with your new database select ‘privileges’ and add your new user (in my case ‘test’) and give it all privileges on your new database.
- I couldn’t get this working correctly, so lazily just use ‘root’ for Wordpress to connect to my database.
Setup your new site using Web Station
- General Settings: Set HTTP back-end server to Apache 2.4 and PHP 7.0
PHP Settings: Set PHP version to 7.0, leave cache enabled
select at least these extensions: curl, exif, ftp, gd, gettext, iconv, mcrypt, mysqli, openssl, posix, soap, sockets, xmlrpc, zip. (I was lazy and enabled ALL extensions!)
Virtual Host: Click Create
enter your new external website name (eg ‘eadietest.ddns.net’) for hostname
browse to your site’s folder for Document root
select Apach HTTP 2.4 and PHP 7.0
Initialise and test
- Use a browser to go to your new site using the external address (assuming that your PC uses your router as DNS server) eg eadietest.ddns.net - Wordpress should prompt that it is going to ask you database settings and initialise.
Database name: your new database
Username: either root, or your new ‘test’ user (if you can get this to work)
Password: either for root or test
This is critical, as far as I can tell, and was the only way I could get rid of the pesky ‘server error 500’ if I just used ‘localhost’ or 127.0.0.1’.
Table prefix: I left it as wp_ as I am going to use a separate database for each site.
Good luck, and do let me know how you get on.