
Plex Media Server is a user-friendly platform for organizing, streaming, and accessing your personal collection of movies, TV shows, music, and photos from any device. It transforms your server into a private media hub, providing a seamless experience across desktops, mobile devices, smart TVs, and web browsers.
In this article, you will deploy Plex Media Server using Docker Compose, configure persistent storage for Plex data and media, and set up Traefik as a reverse proxy to securely access your Plex instance through a custom domain.
Before you begin, you need to:
sudo privileges.plex.example.com).In this section, you prepare the required directory structure for Plex and define environment variables in a .env file.
Create the directory structure for Plex.
This command creates the following directories:
Navigate into the plex-media-server directory.
Create a .env file.
Add the following variables:
Replace:
YOUR_TIMEZONE with your time zone.YOUR_PLEX_CLAIM_TOKEN with the token from the Plex claim page.plex.example.com with your actual domain.admin@example.com with your email.Save and close the file.
In this section, you create and launch the Docker Compose stack that runs Plex behind Traefik. Docker Compose loads the environment variables from your .env file, starts both containers, and configures Traefik to provide secure HTTPS access to your Plex instance.
Create a new Docker Compose manifest.
Add the following content:
Save and close the file.
In the above manifest:
80 and 443 so Traefik can receive and route all external traffic../config, ./transcode, ./media persist Plex configuration, transcoding files, and your media library.letsencrypt stores Traefik TLS certificates./var/run/docker.sock lets Traefik detect containers and apply routing rules.32400) that Traefik forwards secure traffic to.Create and start the services.
Verify that the services are running.
Output:
The above output confirms that both services are running successfully. Plex is healthy, and Traefik is listening on ports 80 and 443 for incoming traffic.
View the logs for the services.
For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.
In this section, you use the Plex web interface to configure your server, claim your instance, and add your media libraries.
Open the Plex web interface in your browser.
On the welcome screen, click GOT IT! to start the setup.
(Optional) You may see a prompt for Plex Pass upgrades.
On the Set Up Your Server page, enter a Server Name.
(Optional) Disable Allow me to access my media outside my home if you want to restrict external access.
If prompted, sign in to your Plex account to claim your server.
Click NEXT to proceed.
On the Add Library page, click ADD LIBRARY to create a new media library.
Select the library type (Movies, TV Shows, Music, Photos, etc.).
Click NEXT, then click BROWSE FOR MEDIA FOLDER. Navigate to the directory you mounted in Docker (for example, /data/movies), select it, and click ADD.
(Optional) Click Advanced to configure settings such as language preferences, metadata behavior, and scanning rules.
Click ADD LIBRARY to save the library configuration.
Repeat the process to add more libraries. You can also add more libraries later from settings.
After you finish adding libraries, click NEXT and then DONE to complete the setup.
Plex now loads your Dashboard, where you can manage libraries, users, and streaming settings.
You have successfully deployed your own Plex Media Server and made it accessible through a secure domain. You set up the required services using Docker Compose, created persistent storage directories for configuration, transcode, and media files, configured Traefik as the reverse proxy, and enabled HTTPS encryption with Let's Encrypt.
0 Comments
Be the first to comment and share your perspective with the community.