Installation Guide · Step 8

Configure Nginx, domain and SSL for Mifos X

Serve the Mifos Web App, securely proxy Apache Fineract, connect production domains and enable HTTPS using Nginx and Let's Encrypt certificates.

Prerequisites

  • A running Apache Fineract backend
  • A compiled and deployed Mifos Web App
  • Ubuntu server with sudo access
  • Nginx installed and running
  • A registered domain or subdomain
  • DNS access for creating A or AAAA records
  • Ports 80 and 443 permitted through the firewall
  • A valid email address for certificate notifications

Example DNS records

HostnameTypeValuePurpose
mifos.example.comAYOUR_SERVER_IPV4Mifos Web App frontend
api-mifos.example.comAYOUR_SERVER_IPV4Apache Fineract API

Configure Nginx and HTTPS

01

Install and start Nginx

Install Nginx from the Ubuntu package repository and enable it during server startup.

sudo apt update
sudo apt install -y nginx

sudo systemctl enable --now nginx
sudo systemctl status nginx --no-pager
Expected result: Nginx should show an active and running status.
02

Confirm the DNS records

Both the frontend and API domains must resolve to the intended server before requesting certificates.

getent hosts mifos.example.com
getent hosts api-mifos.example.com

dig +short mifos.example.com
dig +short api-mifos.example.com
Expected result: The returned IPv4 or IPv6 addresses should match the production server.
03

Confirm the Mifos Web App files

Verify that the compiled frontend exists in the configured Nginx document root.

sudo find /var/www/mifos-web-app -maxdepth 2 -type f | sed -n '1,80p'

sudo test -f /var/www/mifos-web-app/index.html && echo "index.html found"
Expected result: The web root should contain index.html and the compiled JavaScript, CSS and asset files.
04

Confirm Apache Fineract locally

Test the backend directly on the server before placing Nginx in front of it.

curl -k \
  https://127.0.0.1:8443/fineract-provider/actuator/health
Expected result: The Fineract health endpoint should return a healthy status.
05

Create the frontend Nginx configuration

Serve the compiled Angular application and provide fallback routing to index.html.

sudo nano /etc/nginx/sites-available/mifos-web-app
Expected result: A dedicated Nginx server block should exist for the frontend domain.
06

Create the API reverse-proxy configuration

Proxy the public API domain to Apache Fineract on its private local port.

sudo nano /etc/nginx/sites-available/mifos-api
Expected result: A dedicated Nginx server block should exist for the backend API domain.
07

Enable both sites

Create symbolic links in sites-enabled and remove the default site when it is no longer needed.

sudo ln -sfn \
  /etc/nginx/sites-available/mifos-web-app \
  /etc/nginx/sites-enabled/mifos-web-app

sudo ln -sfn \
  /etc/nginx/sites-available/mifos-api \
  /etc/nginx/sites-enabled/mifos-api

sudo rm -f /etc/nginx/sites-enabled/default
Expected result: Both Mifos Nginx configurations should be enabled.
08

Validate and reload Nginx

Always test the configuration before reloading the service.

sudo nginx -t
sudo systemctl reload nginx
Expected result: The configuration test should report that the syntax is valid.
09

Install Certbot

Install Certbot and its Nginx integration package.

sudo apt update
sudo apt install -y certbot python3-certbot-nginx

certbot --version
Expected result: Certbot should display its installed version.
10

Request HTTPS certificates

Request certificates only after both domains resolve correctly and respond through Nginx.

sudo certbot --nginx \
  -d mifos.example.com \
  -d api-mifos.example.com
Expected result: Certbot should obtain certificates and update the Nginx configuration.
11

Test automatic renewal

Perform a dry run to confirm that future certificate renewal can succeed.

sudo certbot renew --dry-run

systemctl list-timers | grep -i certbot || true
Expected result: The renewal simulation should finish successfully.
12

Verify HTTPS

Test the frontend, backend and certificate responses after the configuration is complete.

curl -I https://mifos.example.com/

curl -I \
  https://api-mifos.example.com/fineract-provider/actuator/health

openssl s_client \
  -connect mifos.example.com:443 \
  -servername mifos.example.com \
  </dev/null 2>/dev/null | \
  openssl x509 -noout -subject -issuer -dates
Expected result: Both domains should answer over HTTPS and present valid certificates.

Example Nginx configurations

Mifos Web App

server {
    listen 80;
    listen [::]:80;

    server_name mifos.example.com;

    root /var/www/mifos-web-app;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2)$ {
        expires 7d;
        add_header Cache-Control "public";
        try_files $uri =404;
    }

    access_log /var/log/nginx/mifos-web-app.access.log;
    error_log /var/log/nginx/mifos-web-app.error.log;
}

Apache Fineract API

server {
    listen 80;
    listen [::]:80;

    server_name api-mifos.example.com;

    location / {
        proxy_pass https://127.0.0.1:8443;

        proxy_http_version 1.1;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_connect_timeout 60s;
        proxy_send_timeout 120s;
        proxy_read_timeout 120s;

        proxy_ssl_verify off;
    }

    access_log /var/log/nginx/mifos-api.access.log;
    error_log /var/log/nginx/mifos-api.error.log;
}
The example uses proxy_ssl_verify off only because a locally running Fineract container may use a development certificate. Review and strengthen upstream certificate validation for your production architecture.

Production verification checklist

  • Frontend domain resolves to the correct server
  • API domain resolves to the correct server
  • Port 80 is available for certificate validation
  • Port 443 is available for HTTPS
  • Nginx configuration passes nginx -t
  • Frontend refresh routes return index.html
  • Apache Fineract remains bound privately
  • Forwarded protocol and client IP headers are present
  • Frontend connects to the HTTPS API URL
  • Certbot renewal dry run succeeds
  • HTTP redirects to HTTPS
  • Database ports remain inaccessible publicly

Common Nginx and SSL problems

502 Bad Gateway

Confirm Apache Fineract is running, verify the proxy_pass address and review Nginx and Fineract logs.

Certbot cannot validate the domain

Check DNS, firewall rules, port 80, proxy services and whether the domain points to another server.

404 after refreshing an Angular route

Ensure the frontend location block uses try_files with index.html as the fallback.

Mixed-content browser error

Configure the frontend to use the HTTPS Apache Fineract API URL.

CORS error

Confirm the frontend and API domains, reverse-proxy headers and backend cross-origin configuration.

Certificate works for one domain only

Inspect the certificate names and rerun Certbot with every required hostname.

MifosX deployment services

Need help securing a production Mifos deployment?

MifosX provides Mifos and Apache Fineract domain setup, Nginx configuration, SSL, security hardening, monitoring, backups and production deployment support.