Guide on Setting Up OpenEMR on Ubuntu 24.04 with NGINX
OpenEMR, an open-source Electronic Medical Records (EMR) system, is widely used by healthcare providers to manage patient records, appointments, billing, prescriptions, and clinical workflows. This article provides a detailed guide on deploying OpenEMR on Ubuntu 24.04 with NGINX as the web server.
**System Requirements for OpenEMR on Ubuntu 24.04**
- Operating System: Ubuntu 24.04 LTS (64-bit) - Web Server: NGINX (latest stable version) - Database: MySQL / MariaDB (version 10.2 or higher recommended) - PHP Version: 8.0 or higher (with required extensions: mysqli, gd, mbstring, curl, xml, zip, etc.) - Memory: Minimum 2 GB RAM (4 GB+ recommended for production) - Storage: Minimum 20 GB disk space depending on patient data volume - Additional: OpenSSL, Cron for scheduled tasks
**Use Cases of OpenEMR**
OpenEMR is used in various healthcare settings, including clinics, hospitals, telemedicine, and health informatics research. It offers support for healthcare compliance standards like HIPAA and interoperability standards like FHIR for data exchange.
**Installation Steps to Deploy OpenEMR on Ubuntu 24.04 with NGINX**
1. **Update System and Install Dependencies**
```bash sudo apt update && sudo apt upgrade -y sudo apt install -y nginx mysql-server php-fpm php-mysql php-curl php-mbstring php-xml php-zip php-gd php-bcmath curl unzip cron ```
2. **Configure MySQL / MariaDB**
- Secure MySQL installation:
```bash sudo mysql_secure_installation ```
- Create OpenEMR database and user:
```bash sudo mysql -u root -p CREATE DATABASE openemr CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'openemruser'@'localhost' IDENTIFIED BY 'StrongPassword'; GRANT ALL PRIVILEGES ON openemr.* TO 'openemruser'@'localhost'; FLUSH PRIVILEGES; EXIT; ```
3. **Download and Extract OpenEMR**
- Get the latest OpenEMR release from official source:
```bash cd /var/www/ sudo curl -LO https://github.com/openemr/openemr/releases/latest/download/openemr-latest.zip sudo unzip openemr-latest.zip -d openemr sudo chown -R www-data:www-data openemr ```
4. **Configure PHP for OpenEMR**
- Edit `/etc/php/8.2/fpm/php.ini` (adjust PHP version if needed), and set:
```ini memory_limit = 256M upload_max_filesize = 50M post_max_size = 50M max_execution_time = 300 date.timezone = "Your/Timezone" ```
- Restart PHP-FPM to apply changes:
```bash sudo systemctl restart php8.2-fpm ```
5. **Configure NGINX to Serve OpenEMR**
- Create NGINX server block file `/etc/nginx/sites-available/openemr`:
```nginx server { listen 80; server_name your_domain_or_ip;
root /var/www/openemr; index index.php index.html index.htm;
access_log /var/log/nginx/openemr.access.log; error_log /var/log/nginx/openemr.error.log;
location / { try_files $uri $uri/ /index.php?$query_string; }
location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; # Adjust socket if necessary fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
location ~ /\.ht { deny all; } } ```
- Enable site and reload NGINX:
```bash sudo ln -s /etc/nginx/sites-available/openemr /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl reload nginx ```
6. **Complete OpenEMR Web Installation**
- Open your browser, navigate to `http://your_domain_or_ip` - Follow the on-screen OpenEMR installation wizard: - Enter MySQL credentials created earlier - Configure administrator user - Wait for initialization scripts to complete
7. **Post-Installation Security and Performance Tweaks**
- Remove or secure the `/setup` directory if still present - Set correct ownership and permissions
```bash sudo chown -R www-data:www-data /var/www/openemr sudo find /var/www/openemr -type d -exec chmod 755 {} \; sudo find /var/www/openemr -type f -exec chmod 644 {} \; ```
- Set up regular backups of the database and files - Consider enabling SSL (via Let’s Encrypt) for secure HTTPS access
This approach ensures an efficient, secure, and maintainable deployment of OpenEMR tailored to Ubuntu 24.04 with NGINX, supporting real-world clinical workloads and facilitating integration with modern healthcare IT infrastructure. If you need assistance with automated scripting or cloud deployment for OpenEMR, professionals experienced in healthcare software and web stack optimization on platforms like AWS, Azure, or Google Cloud are available.
Technology used in this setup includes Ubuntu 24.04 LTS, NGINX as the web server, MySQL/MariaDB for the database, and PHP 8.0 or higher with required extensions. The system requires a minimum of 2 GB RAM and 20 GB disk space, and additional components like OpenSSL, Cron for scheduled tasks are also needed. These technologies ensure an efficient, secure, and maintainable deployment of OpenEMR for various healthcare settings, including clinics, hospitals, telemedicine, and health informatics research.