This project sets up a Public Plex Media Server securely proxied through Tailscale and managed by Nginx on a NixOS-based system. It is designed to provide remote access to your Plex server while leveraging Tailscale for private networking and Nginx for robust HTTP(S) proxying.
- Secure Proxying: Utilizes Nginx as a reverse proxy for handling HTTPS connections, configured with an ACME (Let's Encrypt) certificate for your domain.
- Tailscale Integration: Simplifies remote network connectivity using Tailscale's private mesh VPN.
- Optimized for Streaming: Nginx configuration includes settings to enhance streaming performance, support websockets, and reduce buffering for an optimal Plex experience.
- Configurable Firewall: Ensures secure access by restricting allowed traffic to specific ports.
- NixOS Configuration: Fully reproducible and declarative system setup.
- NixOS: This project assumes you're using NixOS for configuration.
- Domain Name: A public domain (e.g., example.domain.net) is required for SSL setup.
- Tailscale Account: Set up a Tailscale network to enable private connectivity.
- Cloudflare DNS: Used for ACME DNS verification in this example.
- Nginx:
- Configured as a reverse proxy for Plex, forwarding traffic from your public domain to the Plex server via Tailscale.
- HTTPS enforced using ACME certificates.
- HTTP2 enabled for better streaming performance.
- Tailscale:
- Proxy traffic to your Plex server through the Tailnet.
- Firewall:
- Ports restricted to ensure secure access (e.g., only TCP and UDP port 443 are allowed).
- System Setup:
- Uses declarative NixOS configuration, including disk setup and bootloader configuration.
The provided configuration.nix file demonstrates:
- Setting up Tailscale for private networking.
- Configuring Nginx as a reverse proxy for Plex.
- Securing Nginx with ACME/Let's Encrypt certificates.
- Setting up a secure DNS resolver for Tailscale hosts.
- Clone the repository or copy the example configuration.
- Replace placeholders like example.domain.net and example.owl-bear.ts.net with your actual domain and Tailscale details.
- Add the configuration to your NixOS system configuration file, or import this file into your existing configuration.
- Run nixos-rebuild switch to apply the changes.
- This example omits parts of the full NixOS configuration for brevity. Additional options, such as disk layout, host platform, and other services, can be added as needed.
- Adjust Nginx settings (e.g., client_max_body_size) to suit your streaming and file upload requirements.
- For full documentation on related NixOS modules, refer to:
This configuration is intended as a starting point. Review and tailor it to meet your specific needs and security requirements before deploying it in production.
This showcases only the proxy side. An important note I'll include is that the
proxyPass
configured is to another Nginx-fronted HTTPS proxy for the Plex Media Server. Hence why the target ishttps
and standard 443 port. If you don't have an Nginx server in front of your Plex, you would target the default 32400 unless configured differently.