Setup SSL using Nginx for Homelab Services¶
By setting up SSL encryption using Nginx Proxy Manager, you ensure a secure, compliant, and performant connection for your homelab services.
Prerequisites¶
- Nginx Proxy Manager: Installed and running on your server. You can install it using Docker or a native installation.
- Domain name: You have a registered domain name and access to DNS settings of this domain.
- Services: You have services like Proxmox, Portainer, Jellyfin, etc. running on your server with their respective ports.
This can be done in two modes.¶
- Private: Accessible via Private IP and not exposed to public internet
- Public: Assessible via public Internet.
Steps¶
Step 1: Create DNS Records in Domain Provider¶
- Login to your domain provider and navigate to dns record section of your domain.
- Add following two records to Public IP or Private IP depending on the mode you want.
- A Record for
subdomain.domain.comto IP - A Record for
*.subdomain.domain.comto same IP for reverse proxy on any *.subdomain to work.
- A Record for
Private Mode: Reverse proxy would only work when you are in your home network directly or via VPN and internet is needed for domain routing.Public Mode: In addition to setting up IP, you'll also need to open required ports in your home network to internet or you can use cloudflare tunnels.
Step 2: Generate SSL in Nginx via Let's Encrypt¶
- Click on the "SSL Certificates" tab in the top navigation menu.
- Click the "Add SSL Certificate" button.
- Select "Let's Encrypt" as the certificate provider.
- Enter your email address and agree to the terms of service.
- Add both the domain names you created in Step 1.
- Enable DNS Challenge and add domain provider API token(permission to edit dns entries)
- Click "Save" to obtain an SSL certificate.
Step 3: Create Proxy Host¶
- Click on the "Proxy Hosts" tab in the top navigation menu.
- Click the "Add Proxy Host" button.
- Fill in the required information:
- Domain: Enter your domain name.
- Scheme: Select "https/http" as the scheme.
- Target URL: Enter the URL of your service (e.g., http://localhost:8006 for Proxmox).
- Target Port: Enter the port number of your service (e.g., 8006 for Proxmox).
- Click on the three dots next to your proxy host and select "Edit".
- Scroll down to the "SSL Certificate" section.
- Select the SSL certificate you obtained in Step 3.
- Click "Save" to create the new proxy host.
Use Proxy Host entry to route to Nginx IP:Port
Before adding anything else, its good idea to use nginx to route to nginx UI using domain and https. Basically, npm.subdomain.domain.com -> nginx-ip:port and select SSL certs while setting this.
Step 4: Test Endpoint¶
- Open a web browser and navigate to https://your-domain-name (replace your-domain-name with your actual domain name).
- You should see the login page of your service (e.g., Proxmox).
- Log in to your service to verify that everything is working correctly.