Reverse Proxy configuration using Nginx
Introduction
This guide explains how to configure NGINX as a reverse proxy for Defguard's components (Core and Proxy). The reverse proxy acts as an intermediary between users and Defguard services, handling HTTPS requests, routing internal gRPC communication, and ensuring encrypted connections between all components.
To provide HTTPS encryption, this guide also uses Certbot, a free, open-source tool from the Let’s Encrypt project. Certbot automatically issues and renews SSL/TLS certificates, allowing you to secure your Defguard domains without manual certificate management.
Installing Nginx and Certbot
Run the followign command to install Nginx and Certbot.
apt install nginx certbotDisable the default Nginx configuration to avoid conflicts:
unlink /etc/nginx/sites-enabled/defaultObtaining SSL certificates
Use Certbot to generate SSL certificates.
For each service (Core, Proxy), run the following command on the server that your domain’s DNS records resolve to. Ensure that inbound traffic on port 80 is allowed by the firewall and that no other process is using this port.
Obtaining SSL certificate for Core service
Use the following command to generate certificate with Certbot. Replace the example domain for the Core service (my-server.defguard.net) with your own.
Certbot will generate certificate in fullchain.pem and privkey.pem in the following path:
Obtaining SSL certificate for Proxy service
Use the following command to generate certificate with Certbot. Replace the example domain for the Proxy service (enroll.defguard.net) with your own.
Certbot will generate certificate in fullchain.pem and privkey.pem in the following path:
Configuring and starting Nginx
Configuring and starting Nginx for Core service
Create a new configuration file for the Core service:
/etc/nginx/sites-available/my-server.defguard.net.conf
Enable the configuration and start Nginx:
To verify, run:
Configuring and starting Nginx for Proxy service
The Proxy service exposes APIs for enrollment, remote onboarding, and desktop client configuration. Create its NGINX configuration file:
/etc/nginx/sites-available/enroll.defguard.net.conf
Enable and restart NGINX:
Security Recommendations
Only expose HTTPS ports (443) for web access.
Do not expose internal gRPC ports (444, 50051, 50055) directly to the Internet.
Summary
After completing the configuration:
Defguard Core is available at
https://my-server.defguard.netEnrollment and onboarding services are available at
https://enroll.defguard.netBoth services are secured with SSL and reverse-proxied through NGINX.
Last updated
Was this helpful?