cravaus wrote on Saturday, August 02, 2014:
Getting OpenEMR running on a Synology NAS has not been documented and the changes that need to be made to get it running are not easily found. With the help of this forum and Google I have success. I am new to Linux and to server technology. I will share what I have learned:
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.
DynamicDNS is free with Synology and works with the Patient Portal if you have your own domain name.
Use the Web Directory only for your website. Do not install OpenEMR there it will not work.
MariaDB, phpMyAdmin, VPN Server, must be loaded.
SSH services, SSL, HTTPS and FTPS all need to be enabled
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.
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/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. Instructions here helped me get it installed.
http://forum.synology.com/wiki/index.php/Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc
You will need to install bash
Use: ipkg install bash
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.”
And it works!