Overview
This guide covers production installation of Nguhöe EHR with proper security, optimization, and reliability configurations. For development setup, see the Quick start guide.System requirements
Server requirements
These requirements are based on the actual dependencies in
composer.json:11-23.-
PHP 8.2+ with extensions:
sqlite3,pdo_mysql, orpdo_pgsql(database drivers)mbstring(multibyte string handling)xml(XML processing)curl(HTTP client)zip(compression)gdorimagick(image processing)bcmath(arbitrary precision mathematics)fileinfo(file type detection)sodium(encryption)
-
Database: One of the following
- SQLite 3.35+ (small deployments)
- MySQL 8.0+ or MariaDB 10.6+
- PostgreSQL 13+
-
Web server:
- Nginx (recommended)
- Apache with
mod_rewrite
- Composer 2.0+
- Node.js 18+ and npm
- Supervisor (for queue workers)
Recommended server specifications
| Deployment size | CPU | RAM | Storage |
|---|---|---|---|
| Small (1-5 users) | 2 cores | 2 GB | 20 GB SSD |
| Medium (5-20 users) | 4 cores | 4 GB | 50 GB SSD |
| Large (20+ users) | 8 cores | 8 GB | 100 GB SSD |
Installation steps
Install dependencies
Install PHP dependencies with production optimizations:The
--optimize-autoloader flag converts PSR-0/4 autoloading to classmap for better performance, and --no-dev excludes development packages.Install and build JavaScript dependencies:The build process compiles React components and Tailwind CSS into optimized production assets.
Configure environment
Copy the example environment file:Edit
Create the database file:
Create the database:
Create the database:
.env with production values:Required configurations
Database configuration
SQLite (Small deployments)
SQLite (Small deployments)
MySQL/MariaDB (Recommended)
MySQL/MariaDB (Recommended)
PostgreSQL
PostgreSQL
Session and cache
Database-backed sessions and cache work well for small to medium deployments. For larger deployments, consider Redis.
Mail configuration
Backup configuration
Add backup notification email:Run database migrations
Create all database tables:The
--force flag is required in production to confirm migration execution.This creates tables for:- Users and authentication
- Roles and permissions (Spatie Permission)
- Patients
- Appointments
- Consultations
- Prescriptions
- Payments
- Attachments
- Doctor schedules
- Jobs queue
- Cache and sessions
Set file permissions
Set proper permissions for storage and cache:If using SQLite:
The web server needs write access to
storage, bootstrap/cache, and the SQLite database file.Configure web server
Nginx configuration
Create a new site configuration:Apache configuration
Apache configuration
If using Apache, create a virtual host:Enable required modules:
Configure SSL certificate
Obtain an SSL certificate using Let’s Encrypt:Certbot will automatically configure SSL in your Nginx configuration.
Certificates auto-renew via cron. Test renewal with:
sudo certbot renew --dry-runSet up queue worker
Create a Supervisor configuration for the queue worker:Add this configuration:Update Supervisor:
The queue worker processes background jobs for emails, notifications, and backups.
Configure scheduled tasks
Add Laravel’s scheduler to crontab:Add this line:This enables scheduled tasks including:
- Database backups
- Log cleanup
- Session garbage collection
Production optimization
Cache configuration
Cache configuration and routes for better performance:PHP-FPM optimization
Edit PHP-FPM pool configuration:OPcache configuration
Enable OPcache for PHP:Database optimization
MySQL/MariaDB
PostgreSQL
Security checklist
Environment file
-
.envfile has secure permissions (600) -
APP_DEBUG=falsein production -
APP_ENV=production - Strong
APP_KEYgenerated - Database credentials are secure
Web server
- HTTPS enabled with valid certificate
- HTTP redirects to HTTPS
- Security headers configured
- Hidden files (
.env,.git) are blocked - File upload size limits configured
File permissions
- Web server owns application files
- Storage directories are writable (775)
-
.envis not web-accessible (600) - Public directory is the only web-accessible directory
Database
- Database user has minimal required privileges
- Database password is strong
- Database backups are configured
- Off-site backup storage is configured
Monitoring and maintenance
Log monitoring
Monitor application logs:Queue monitoring
Check queue worker status:Database maintenance
Regularly optimize database:Update procedure
When updating Nguhöe EHR:Troubleshooting
500 Internal Server Error
500 Internal Server Error
Check the Laravel log:Common causes:
- Missing
.envfile - Incorrect file permissions
- Database connection issues
- Missing
APP_KEY
Queue jobs not processing
Queue jobs not processing
Check worker status:Restart worker:Check worker logs:
PDF generation fails
PDF generation fails
Ensure DomPDF dependencies are installed:Verify storage permissions:
Backup fails
Backup fails
Check backup configuration:Run backup with verbose output:Verify storage disk configuration in
config/filesystems.php.Performance issues
Performance issues
Check these areas:
-
OPcache status:
-
Database slow queries:
Enable slow query log in MySQL:
-
Queue backlog:
- Cache hit rate: Monitor cache effectiveness and consider Redis for larger deployments.
Next steps
After successful installation:Configuration
Customize Nguhöe EHR for your clinic
User management
Create staff accounts and assign roles
Backup strategy
Configure comprehensive backup strategy
Security hardening
Additional security measures and best practices
Support
If you encounter issues:- Check the troubleshooting section above
- Review Laravel logs in
storage/logs/ - Search existing issues on GitHub
- Create a new issue with detailed information