For our examples we will use the following:
MAD runs on localhost
madmin_port is port 5000
ws_port is 8080
mitmreceiver_port is 8000
We wish to access MADmin at madmin.example.com
We wish to proxy the RGC traffic to rgc.example.com
We wish to proxy the PogoDroid traffic to pd.example.com
The FQDN (Domain) we are using is example.com
SSL Certificate is located at /etc/letsencrypt/live/example.com/cert.pem
SSL Certificate Key is located at /etc/letsencrypt/live/example.com/privkey.pem
Make sure that the module proxy and rewrite is installed and enabled (a2enmod proxy proxy_http).
Keep in mind to configure the DNS settings correctly to make the three subdomains work.
MADmin URL: https://madmin.example.com
<VirtualHost *:443>
ProxyPreserveHost On
ProxyRequests Off
ServerName madmin.example.com
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
SSLEngine on
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
ErrorLog ${APACHE_LOG_DIR}/madmin_error.log
CustomLog ${APACHE_LOG_DIR}/madmin_access.log combined
</VirtualHost>
Please install the websocket apache module: a2enmod proxy_wstunnel
RGC URL: wss://rgc.example.com
<VirtualHost *:443>
ServerName rgc.example.com
ProxyPass / ws://127.0.0.1:8080/
ProxyPassReverse / ws://127.0.0.1:8080/
SSLEngine on
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
ErrorLog ${APACHE_LOG_DIR}/rgc_error.log
CustomLog ${APACHE_LOG_DIR}/rgc_access.log combined
</VirtualHost>
PogoDroid URL: https://pd.example.com
<VirtualHost *:443>
ServerName pd.example.com
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
SSLEngine on
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
ErrorLog ${APACHE_LOG_DIR}/pd_error.log
CustomLog ${APACHE_LOG_DIR}/pd_access.log combined
</VirtualHost>