Plausible Analytics: Problem on how to enable https


Server details:

  1. OS: Ubuntu 22.04.2 LTS

  2. Cyberpanel:
    Current Version: 2.3 Build: 4
    Current Commit: 93bf01922d2f4a9cb52a375809f94e0ed293cc2a
    Latest Version: 2.3
    Latest Build: 4
    Latest Commit: 93bf01922d2f4a9cb52a375809f94e0ed293cc2a

  3. I have successfully installed Plausible Analytics through Docker, using the instruction in the plausible self-hosting guide. However by default, Plausible runs on unencrypted HTTP on port 8000. Plausible recommend running it on HTTPS behind a reverse proxy of some sort.

My problem is how to run it on HTTPS, I would like to ask:
a. Does the domain setup by cyberpanel run on a reverse proxy?
b. Assuming the domain is run on a reverse proxy, can I use this instruction to setup the https and whether it interferes with the current cyberpanel settings:


Configuration for reverse-proxy/apache2/plausible.conf:
<VirtualHost *:80>

ProxyPreserveHost On
ProxyPass / localhost:8000/
ProxyPassReverse / localhost:8000/

SetEnvIf X-Forwarded-For “^.......” forwarded
LogFormat “%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"” combined
LogFormat “%{X-Forwarded-For}i %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"” forwarded

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined env=!forwarded
CustomLog ${APACHE_LOG_DIR}/access.log forwarded env=forwarded

Install the necessary Apache modules and restart Apache. Edit the file reverse-proxy/apache2/plausible.conf to contain the domain name you use for your server, then copy it into Apache’s configuration folder. Enable it by creating a symlink in Apache’s enabled sites folder with a2ensite command. Finally use Certbot to create a TLS certificate for your site:

$ sudo a2enmod proxy proxy_http proxy_ajp remoteip headers
$ sudo systemctl restart apache2
$ sudo cp reverse-proxy/apache2/plausible.conf /etc/apache2/sites-available/
$ sudo a2ensite plausible.conf
$ sudo systemctl restart apache2
$ sudo certbot --apache

Hope somebody can help me with this problem.

Thank you.