OpenEMR Installation on Synology DS214 + NAS

From OpenEMR Project Wiki

Overview

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

Reconfiguration

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/config.inc.php

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].

Bash

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 www.YourDNS.com.crt
chmod 400 www.YourDNS.com.key

Set up the Tun module library:

cd /lib/modules/
insmod tun.ko

Edit connect.sh

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

Edit disconnect.sh

Change:
! /bin/bash
To:
!/opt/bin/bash
Save.
Change permissions on this file:
chmod 0777 /usr/syno/etc/synovpnclient/openvpn/disconnect.sh
Make it executable:
cd /usr/syno/etc/synovpnclient/openvpn/
chmod +x connect.sh

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:

/usr/syno/etc/synovpnclient/openvpn/connect.sh

Run the following to start VPN for OpenEMR:

./connect.sh

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.”

Author

Craig Tucker, LCSW