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:

  1. Log in to the DiskStation
  2. 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.

  3. 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:

    NameVirtualHost *:80

    Now you can define your <VirtualHost>’s. Here’s an example:

    NameVirtualHost *:80
    
    #
    # site1.mydomain.nl
    #
    <VirtualHost *:80>
    ServerName site1.mydomain.nl
    DocumentRoot   /volume1/web/site1.mydomain.nl/htdocs
    php_admin_value magic_quotes_gpc off
    </VirtualHost>
    
    #
    # site2.mydomain.nl
    #
    <VirtualHost *:80>
    ServerName  site2.mydomain.nl
    DocumentRoot   /volume1/web/site2.mydomain.nl/htdocs
    php_admin_value magic_quotes_gpc off
    </VirtualHost>
  4. 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.