browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.

Fix Synology Web Server

Posted by on March 10, 2013

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:

 

SSH into the Synology box, change to the directory /usr/syno/etc. Before editing the file make a backup copy.   Use Vi to open the file http-vhost.conf-user and do your edits.  Below is a sample of the before and after edit for the VirtualHost.

 

Add ServerAlias www.wheland.com to each entry domain.com

 

Before  Entry

<VirtualHost *:80>
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

<VirtualHost *:80>
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>

 

After editing and saving the files, the Apache Server need to be restarted for the changes to take effect.  The command to Restart Server is:

 

/usr/syno/etc/rc.d/S97apache-user.sh restart

 

Note: If the Apache server fails to start check spelling and syntax. (if worse case scenario happens, copy the backup file back and restart)

 

Now you will find that you have the full 30 websites available.

 

I haven’t tried yet but  I this this technique will get past the 30 virtual host limit that Synology built into the GUI Interface.

 

Good Luck

 

4 Responses to Fix Synology Web Server

Leave a Reply

Your email address will not be published. Required fields are marked *