Fix Synology Web Server – How to add a ServerAlias to web server config
The Synology NAS has the Apache web Server built-in, it is designed to limit to hosting 30 virtual websites. My website is running on a Synology 411Slim, makes a good web server with a lot of function built in. Setup a virtual website is quick an easy through the Synology control panel, you enter the directory and domain name leave the port default and you are done. Copy your file to the new directory and your website is up.
The first issue that I ran into was that www.domainX.com and domainX.com are considered separate websites, you have create to entries point to the same directory so in the process you lose half of your virtual servers, limiting you to 15 websites. Now for a small business hosting a website this is not an issue, but these boxes make great little web hosts, especially the larger boxes, they should be able to host a hundred websites. I called tech support at Synology and asked why the VirtualHost limit was set to 30 hosts, the answer was that is the way it is designed, not a reason for setting the limit. I have to admit it is a 6x improvement over the 5 VirtualHost limit.
I found how to resolve this issue, it requires SShing into the box and manually editing the configuration file. The GUI does not allow you create an Alias Server which allows domainX.com to be presented as www.domainX.com.
WARNING: Once you manually edit httpd-vhost.conf-user: DO NOT USE THE (Control Panel -> Web Services -> Virtual Host) to make any changes, it will wipe out your entries.
This can be fixed my manually editing the file /usr/syno/etc/httpd-vhost.conf-user:
Before Entry
ServerName wei-tek.com
DocumentRoot “/var/services/web/wei-tek”
ErrorDocument 403 “/webdefault/sample.php?status=403”
ErrorDocument 404 “/webdefault/sample.php?status=404”
ErrorDocument 500 “/webdefault/sample.php?status=500”
VirtualHost>
After Entry
ServerName wei-tek.com
ServerAlias www.wei-tek.com #added entry
DocumentRoot “/var/services/web/wei-tek”
ErrorDocument 403 “/webdefault/sample.php?status=403”
ErrorDocument 404 “/webdefault/sample.php?status=404”
ErrorDocument 500 “/webdefault/sample.php?status=500”
</VirtualHost>
4 Responses to Fix Synology Web Server