Tuesday, August 16, 2022

PMM2 Apache2 Reverse Proxy Linux

Leave a Comment

Problem

You want to add a custom domain name for your PMM2 dashboard.

Solution

Use Apache2 Reverse Proxy to manage the domain name and also be able to generate Let's Encrypt certificates if needed.

Create the file /etc/apache2/sites-available/pmm.yourdomain.com
<VirtualHost *:80> 
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName pmm.yourdomain.com
  ServerAlias www.pmm.yourdomain.com
  ProxyPass / http://localhost:880/
  ProxyPassReverse / http://localhost:880/
</VirtualHost>

<VirtualHost *:443>
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName pmm.yourdomain.com
  ServerAlias pmm.yourdomain.com
  ProxyPass / http://localhost:8443/
  ProxyPassReverse / http://localhost:8443/
</VirtualHost>
Enable the domain by running
a2ensite pmm.yourdomain.com
service apache2 restart

Tips

  • Make sure to add the trailing slash / in the ProxyPass URL

0 comentarii:

Post a Comment