𝗨𝘀𝗶𝗻𝗴 𝗔𝗽𝗮𝗰𝗵𝗲 𝗮𝗻𝗱 𝗡𝗴𝗶𝗻𝘅 𝗣𝗿𝗼𝘅𝘆 𝗠𝗮𝗻𝗮𝗴𝗲𝗿 𝗳𝗼𝗿 𝗗𝗼𝗺𝗮𝗶𝗻 𝗔𝗰𝗰𝗲𝘀𝘀

You often run multiple services on a VPS. You want to use domain names instead of IP addresses and ports. This guide shows you how to use Apache to point a domain to Nginx Proxy Manager (NPM).

Step 1: Setup your DNS

You must point your subdomain to your VPS IP address.

Step 2: Configure Apache as a Reverse Proxy

Apache can take traffic from your domain and send it to your Docker container.

<VirtualHost *:80> ServerName ngx.iquipedigital.cloud ProxyPreserveHost On ProxyPass / http://127.0.0.1:8081/ ProxyPassReverse / http://127.0.0.1:8081/ ErrorLog ${APACHE_LOG_DIR}/ngx_error.log CustomLog ${APACHE_LOG_DIR}/ngx_access.log combined

Step 3: Add SSL Security

Use Certbot to get an SSL certificate via Let’s Encrypt. sudo certbot --apache -d ngx.iquipedigital.cloud

Two ways to manage your services:

  1. Use Apache as the front layer. Apache handles the domain and sends traffic to NPM. This works well if Apache is already running your main sites.

  2. Use NPM as the front layer. Stop Apache from using ports 80 and 443. Let NPM listen on those ports directly. This lets you manage all subdomains through the NPM dashboard.

Choose the method that fits your workflow.

Source: https://dev.to/wildshark/using-apache-and-nginx-proxy-manager-together-for-domain-based-access-e63