Reverse Proxy configuration using NGINX

Introduction

This guide explains how to configure NGINXarrow-up-right as a reverse proxy for Defguard's components (Core and Edge). The reverse proxy acts as an intermediary between users and Defguard services, handling HTTPS requests and ensuring encrypted connections.

To provide HTTPS encryption, this guide also uses Certbotarrow-up-right, a free, open-source tool from the Let's Encryptarrow-up-right project. Certbot automatically issues and renews SSL/TLS certificates, allowing you to secure your Defguard domains without manual certificate management.

circle-info

Since version 2.0 Defguard also includes the ability to handle HTTPS termination for both Core and Edge by itself by using a built-in CA or automatically provisioning Let's Encrypt certificates. This means that you don't necessarily need a separate reverse proxy to safely access Defguard services.

Learn more about this feature here.

Installing NGINX and Certbot

To install and prepare NGINX with Let's Encrypt certificates:

apt install nginx certbot
systemctl enable nginx.service
systemctl start nginx.service

Disable the default configuration to avoid conflicts:

unlink /etc/nginx/sites-enabled/default

Obtaining SSL Certificates

Before configuring NGINX, issue valid SSL certificates for your domains. In this example we use:

  • Core: my-server.defguard.net

  • Edge: enroll.defguard.net

Generate certificates with Certbot:

Certbot will generate certificate in fullchain.pem and privkey.pem in the following paths:

Defguard Core NGINX configuration

Create a new configuration file for the Core service:

/etc/nginx/sites-available/my-server.defguard.net.conf

Enable the configuration and reload NGINX:

To verify, run:

circle-info

If you use this simple setup and run all services on one server, you can use NGINX access restrictionsarrow-up-right for securing core and allowing to access the my-server.defguard.net only to selected networks - blocking the direct access from the Internet.

Defguard Edge (Enrollment Service) NGINX configuration

The Edge service exposes APIs and Web UI for desktop & mobile client configuration and the user password reset process.

Create its NGINX configuration file:

/etc/nginx/sites-available/enroll.defguard.net.conf

Enable and restart NGINX:

Security Recommendations

  • Only expose HTTPS port 443 for public web access.

  • Do not expose internal gRPC ports (8000, 8080, 50051, 50066) directly to the Internet.

Summary

After completing the configuration:

  • Defguard Core is available at https://my-server.defguard.net

  • Edge services are available at https://enroll.defguard.net

  • Both services are secured with SSL and reverse-proxied through NGINX.

Last updated

Was this helpful?