Ponk Room On The Web
A closer look at running your own web site on the Synology
These pictures celebrate some of the UKs' computer pioneers, and give you something to look at if you get bored with all the text. There are many more names I could add to this list - I might do that one day.
Sir Tim Berners-Lee, the inventor of the World Wide Web.
The world's first web site went live on 6th August 1991.
Alan Turing - WW2 code breaker and computer pioneer
Turing cracked the German Enigma cipher machine in WW2. Some people estimate this shortened the war by two years.
Colossus Computer, Bletchley Park UK, 1944
Used to break the Lorenz SZ42 cypher machine from late 1943 to the end of WW2. Designed and built by Tommy Flowers. There is a working re-creation of Colossus at the National Museum of Computing ( NB NOT at Bletchley Park)
Manchester University "Baby" 1948
No matter what the Americans say, THIS was the first stored program computer in the world - 32 words of memory. You can see a working replica of Baby at the Museum of Science and Industry (MOSI) in Manchester .
The American ENIAC was a couple of years earlier, but it was not a stored program machine. You programmed it with fly leads and jack plugs, and it took a very long time - several days and many people.
This web site is hosted on my Synology DS220, which is sitting here at home, on my desk. Anyone remember Windows Home Server ? Now long gone. as is the hardware I used to run it on - a small headless PC made by a company called Tranquility. It worked well - I had shares on my local network, centralized backup and hosted a couple of websites and an email server. When Windows Home Server was withdrawn in 2011 I looked around for an alternative. I had access to a professional server and could "borrow" a bit of the bandwidth to run a couple of personal websites and that was fine until a couple of years ago when I no longer had the big server. So now I'm having to use my own resources again.
This is not a beginners guide to running a web site from home. I'm highlighting the things which tripped me up when I first attempted hosting on the Synology. I think I've discovered solutions to all the problems - some of them were just "finger trouble".
Ignore this section at the moment. I can't figure out how to hide the end of the URL and use GET to post form value
Look at the URL in the address bar above. The URL has been re-written to remove the file type. This is just one of the many useful things possible with URL re-writing. It's done by the web server - Apache 2.2 in this case - and to be able to do this you need to have "mod-rewrite" turned on. You can do this by making an entry in the Apache configuration file called httpd.conf . But you can't edit this directly on the NAS. There's many queries in the forum about this and many improbable answers mainly to do with setting up secure shell access to the NAS. One slip and your're dead ! But you don't need to edit this file. You can make an entry in a file called .htaccess, which is placed at the root of your website. Apache reads this file evry time it accesses the root folder. You put the same directives in this file as you would put in the .conf file. The .conf file affects every folder, the .htaccess only the folder where it is located. For how to do this and other example - go here
Configuring PHP to use PDO ( PHP Data Objects )I thought reading and writing to the MariaDB ( mySQL ) database would be straightforward. I already had a collection of tried and trusted PHP classes using PDO ( PHP Data Objects ). But nothing happened when I tried to read a table. No errors and no data. It does not help that you cannot access the Apache error log. But you can find out how PHP is configured by executing the statement phpinfo() in a PHP file. This will tell you what PHP modules are active. When I did this there was no sign of PDO - and a number of other useful things too. I searched around for something like an "Edit PHP.INI" button. There's nothing in the Synology manual about this. I finally found it -- see below:
- From the Main Menu open Web Station
- In the left hand Menu list is an entry "PHP Settings"
- You'll see a list of the PHP versions you have chosen to use
- Click on the line containing the version of PHP you are using
- Click the "Edit" button at the top of the page
- Voila - edit the php.ini file
Dynamic DNS (DDNS) - hosting your own web site(s)
One of the things you have to control if you are going to host a website at home is your external IP address - the address people use to connect to your modem/router. You can see what it is by looking here. The problem is, it changes, outside of your control. Your service provider is the most likely reason. It does not change very often, but if you turn your modem off for a couple of hours, when you switch it back on you'll probably find that your external IP has changed.
The way to deal with this is to use a Dynamic Domain Name System ( DDNS ). Those nice folks at Synology provide each user with a free web address of the form "www.yourwebname.synology.me" This website is a Synology provided one - look at the address above. The "yourwebname" bit is "ponkroom" in this case. The IP address resolution is done for you. You get one for each NAS you own. It just works.
What about using your own domain name ? Well, you still need a DDNS and there is, I think, one provided on the Synology NAS, but the description in the manual is so vague I cannot understand what it is supposed to do. It should forward your external IP address to a DDNS provider ( like this (DNS MAX).) for example. Then you set the nameservers for your domain to point to DNS MAX. So when someone does a look-up on your domain name they get your latest address from DNS MAX. So, even though I presume to know what should happen, I still cannot understand what is described in the Synology documentation. This is a frequent occurrence for me with Synology documents.
The final piece of the jigsaw is something which reads you external IP and sends it to the DDNS providser ( what, I think the Synology does, but who knows ? ) I use a program ( I think they are called Apps nowadays ) called DirectUpdate which runs as a Windows service.
There is a website on this NAS which has a "proper" domain name. One tip - use a different virtual host for the non-www & www versions of the name.