1. Introduction
Install Plex Media Server on a Raspberry Pi 5 running Virtualmin (with Apache), including making it reachable via a subdomain as for example plex.example.com, is not complicated. Plex Media Server won’t be an install “inside” a Virtualmin website, but at the host level on server.example.com. Via a dummy Virtualmin website the plex.example.com will be forwarded to the Plex Media Server using Virtualmin/Apache as a reverse proxy.
2. Requirements
Required before starting to install Plex Media Server on a Raspberry Pi:
- A Raspberry Pi server running Webmin, Virtualmin with Apache server and CSF. If not see articles How to install Webmin on a Raspberry Pi?, Hosting multiple websites on a Raspberry Pi with Virtualmin
- A valid domain name for your Plex Media Server before issuing an SSL certificate using Let’s Encrypt. Make sure the DNS records propagate worldwide, which you can check using an online tool like DNS Checker.
In this article the domain name plex.example.com is used. Please replace it with your own domain.
3. Setup Plex Media Server
Instructions how to Install Plex Media Server on a Raspberry Pi is divided in the following sections:
- Install Plex Media Server
- Create a storage area for media
- Create a Virtualmin server
3.1 Install Plex Media Server
- Assure server is up to date
1sudo apt update - Install the packages curl and gnupg2 if not available already
1sudo apt install -y curl gnupg2 - Add the official Plex APT repository to a Debian/Ubuntu/Raspberry Pi OS system, so Plex Media Server can be installed and updated via apt:
12345curl -L https://downloads.plex.tv/plex-keys/PlexSign.v2.key \| sudo gpg --yes --dearmor -o /etc/apt/keyrings/plexMedia Server.v2.gpgecho "deb [signed-by=/etc/apt/keyrings/plexMedia Server.v2.gpg] https://repo.plex.tv/deb/ public main" \| sudo tee /etc/apt/sources.list.d/plex.list - Execute following commands
12sudo apt updatesudo apt install -y plexMedia Server - Start Plex Media Server now and make sure it starts automatically after every reboot.
12sudo systemctl enable --now plexMedia Serversudo systemctl status plexMedia Server - Check Plex Media Server is working locallY:
1curl -I http://127.0.0.1:32400/web
You should see something like:
from another device you can use for example (change IP address to the one from your webserver):
1http://192.168.1.22:32400/web
Which will show the Plex Media Server site.
3.2 Create a storage area for media files
- Create the media folders
123sudo mkdir -p /home/domains/plex_example_com_media/moviessudo mkdir -p /home/domains/plex_examnle_com_media/tvsudo mkdir -p /home/domains/plex_example_com_media/music - Set the correct rights
123456sudo groupadd -f plexmediasudo usermod -aG plexmedia plexsudo chgrp -R plexmedia /home/domains/plex_example_com_mediasudo find /home/domains/plex_example_com_media-type d -exec chmod 755 {} \;sudo find /home/domains/plex_example_com_media-type f -exec chmod 644 {} \; - Restart Plex
1sudo systemctl restart plexMedia Server
3.3 Create a Virtualmin server
- In Virtualmin, create a new virtual server such as with domain name plex.example.com and Apache enabled. SSL will be enabled by default in Virtualmin.
See also article ‘Install Virtualmin on a Raspberry Pi’ - Reverse-proxy Plex through Apache. Make sure required modules are present:
12sudo a2enmod proxy proxy_http headers sslsudo systemctl reload apache2 - Edit the file ‘plex.familykruse.eu.conf’ in folder ‘/etc/apache2/sites-available’. Add the following under the Port 80 vhost:
12345678910111213ProxyRequests OffProxyPreserveHost On# Keep ACME workingProxyPass /.well-known !ProxyPassReverse /.well-known !RequestHeader set X-Forwarded-Proto "http"RequestHeader set X-Forwarded-Port "80"RequestHeader set X-Forwarded-Host "plex.krusesite.nl"ProxyPass / http://127.0.0.1:32400/ upgrade=websocketProxyPassReverse / http://127.0.0.1:32400/
En voor Port 443 vhost:
12345678910111213ProxyRequests OffProxyPreserveHost On# Keep ACME workingProxyPass /.well-known !ProxyPassReverse /.well-known !RequestHeader set X-Forwarded-Proto "https"RequestHeader set X-Forwarded-Port "443"RequestHeader set X-Forwarded-Host "plex.krusesite.nl"ProxyPass / http://127.0.0.1:32400/ upgrade=websocketProxyPassReverse / http://127.0.0.1:32400/ - Restart Apache
1sudo systemctl reload apache2
3.3 Initial configuration of Plex Media Server
To get the subdomain plex.example.com correctly working throughout Plex Media Server, perform the next steps.
- Go in browser to https://plex.example.com
- Go to Settings → Server → Network → Show Advanced → Custom server access URLs and add the following:
1https://plex.familykruse.eu:443
Plex documents this option specifically for situations involving a reverse proxy or custom subdomain; the URL is published to plex.tv for server discovery. - Within the server terminal check everyting is working fine by using the commands:
123curl -I http://127.0.0.1:32400/webcurl -I https://plex.example.com/webcurl -I http://plex.example.com/web
Something like below should be shown
123456789101112131415161718192021HTTP/1.1 302 Moved TemporarilyX-Plex-Protocol: 1.0Location: http://127.0.0.1:32400/web/index.htmlCache-Control: publicContent-Length: 0Connection: Keep-AliveKeep-Alive: timeout=20Date: Mon, 27 Apr 2026 20:12:16 GMTHTTP/2 302x-plex-protocol: 1.0cache-control: publicdate: Mon, 27 Apr 2026 20:12:16 GMTlocation: https://plex.example.com/web/index.htmlserver: ApacheHTTP/1.1 301 Moved PermanentlyDate: Mon, 27 Apr 2026 20:12:16 GMTServer: ApacheLocation: https://plex.example.com/webContent-Type: text/html; charset=iso-8859-1
What should be shown is:
– 127.0.0.1:32400/web geeft Plex-response.
– https://plex.example.com/web gives Plex-response or redirect to Plex web.
– http://plex.familykruse.eu/web gives a 301 to HTTPS.
4. Finally
This concludes how to install Plex Media Server on a Raspberry Pi running Webmin, Virtualmin and ConfigServer Security & Firewall. The next step is configuring the Plex Media Server.




0 Comments