OpenEMR Installation on Synology DS214 + NAS

From OpenEMR Project Wiki


Port forward Router Settings:

TCP only: 80,443,873,5001
TCP and UDP: 137-139,445,465,995,993,1194

Similar settings are on the NAS firewall except on the NAS 22 needs to be open for Local SSH access.

Dynamic DNS is free with Synology and works with the Patient Portal if you have your own domain name.

MariaDB, phpMyAdmin, VPN Server, must be loaded.

SSH services, SSL, HTTPS and FTPS all need to be enabled.

OpenEMR Location

You must create one user, enable a personal website location for that user. OpenEMR needs to be extracted and installed in the www folder for that user. Use the Web Directory only for your website. Do not install OpenEMR where it will not work.

SSL Encryption

Redirect for SSL Encryption

Edit httpd.conf-user

At the line:

<VirtualHost *:80="">
Include sites-enabled-user/*.conf

Add the following:

Redirect permanent /~[User Name]/openemr https://Your.Domain:443/~[User Name]/openemr

Restart: /usr/syno/sbin/synoservicecfg --restart httpd-user


Edit globals.php

Change this line:
$web_root = substr($webserver_root, strspn($webserver_root ^ $server_document_root, "\0"));
To be:
$web_root = '/~[User Name]/openemr';

Start the installation with www.Your DomainName/~[User Name]/openemr

Modify OpenEMR phpMyAdmin config file

chmod 0755 /volume1/homes/[user]/www/openemr/phpmyadmin/

Patient Portal

The NAS must be bootstrapped. There is no boot strap package for the DS214+. The older Kirkwood mv6281 bootstrap package will work. See [this] and [this].


You will need to install bash.

Use: ipkg install bash

VPN for Patient Portal (using OpenVPN)

You cannot use the graphic utility in the Synology DSM OS to run the VPN for the Patient Portal.

You must use a command line to start it and modifications are needed.

Path to OpenVPN: /usr/sbin/openvpn

Location for OpenEMR Portal Certificates:

You will need to extract the OpenEMR zip file to: /usr/syno/etc/synovpnclient/openvpn/

Change permissions

chmod 600 pass
chmod 400 ca.crt
chmod 400
chmod 400

Set up the Tun module library:

cd /lib/modules/
insmod tun.ko


Delete all and change to
cd /usr/syno/etc/synovpnclient/openvpn/
openvpn --config vpnclient.ovpn
Change permissions on this file:
chmod 0777 /usr/syno/etc/synovpnclient/openvpn/
Make it executable:
cd /usr/syno/etc/synovpnclient/openvpn/
chmod +x


! /bin/bash
Change permissions on this file:
chmod 0777 /usr/syno/etc/synovpnclient/openvpn/
Make it executable:
cd /usr/syno/etc/synovpnclient/openvpn/
chmod +x

Add the following to rc.local for automatic vpn connectivity when it restarts:

cd /etc/rc.local

Open to edit, add the following path to the end before Exit 0:


Run the following to start VPN for OpenEMR:


This should start the program and you will see a string of commands. It will take a minute or two to complete and it will end with a statement such as: “This completes the installation sequence.”


Craig Tucker, LCSW