Configuring DiskStation for multiple websites
The Synology DiskStation comes with the Apache webserver. The “Web Station” functionality allows you to host a website. You can even run multiple virtual hosts. These “default” virtual hosts, however, cannot be configured in detail.
But it is very well possible to host multiple websites on a single DiskStation, while still being able to configure the virtual host in every detail. Here is how:
- Log in to the DiskStation
- Edit the /usr/syno/apache/conf/httpd.conf-user file
DiskStation% sudo vi /usr/syno/apache/conf/httpd.conf-user
Locate the following text:
# Virtual hosts #Include conf/extra/httpd-vhosts.conf
Uncomment the last line, so that it becomes:
# Virtual hosts Include conf/extra/httpd-vhosts.conf
Save the file.
- Now create the httpd-vhosts.conf file (the one you included above):
DiskStation% sudo vi /usr/syno/apache/conf/extra/httpd-vhosts.conf
Make sure this file starts with the following directive:
Now you can define your <VirtualHost>’s. Here’s an example:
NameVirtualHost *:80 # # site1.mydomain.nl # <VirtualHost *:80> AddDefaultCharset utf-8 ServerName site1.mydomain.nl DocumentRoot /volume1/web/site1.mydomain.nl/htdocs php_admin_value magic_quotes_gpc off </VirtualHost> # # site2.mydomain.nl # <VirtualHost *:80> AddDefaultCharset utf-8 ServerName site2.mydomain.nl DocumentRoot /volume1/web/site2.mydomain.nl/htdocs php_admin_value magic_quotes_gpc off <VirtualHost>
- Restart Apache:
DiskStation% sudo /usr/syno/apache/bin/httpd -k restart
Note that I set magic_quotes_gpc to off explicitly in all my virtual hosts. Synology’s own PHP-code (for the admin interface) needs the magic quotes setting to be on, which is just bad practice.