more plex

This commit is contained in:
Peder Bergebakken Sundt 2024-02-10 21:31:48 +01:00
parent 47b3a5112e
commit 216484a80c
2 changed files with 26 additions and 10 deletions

View File

@ -32,6 +32,11 @@ in
services.nginx.enable = true;
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx.recommendedGzipSettings = true;
services.nginx.recommendedOptimisation = true;
services.nginx.recommendedProxySettings = true;
services.nginx.recommendedTlsSettings = true;
/** /
services.nginx.virtualHosts."" = {
default = true;

View File

@ -38,7 +38,7 @@
http2 = true;
locations."/" = {
proxyPass = "http://127.0.0.1:32400"; # TODO: make configurable
#proxyWebsockets = true;
proxyWebsockets = true;
};
# from https://nixos.wiki/wiki/Plex
extraConfig = ''
@ -63,12 +63,12 @@
proxy_set_header Origin $server_addr;
# Plex has A LOT of javascript, xml and html. This helps a lot, but if it causes playback issues with devices turn it off.
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css text/xml application/xml text/javascript application/x-javascript image/svg+xml;
gzip_disable "MSIE [1-6]\.";
#gzip on;
#gzip_vary on;
#gzip_min_length 1000;
#gzip_proxied any;
#gzip_types text/plain text/css text/xml application/xml text/javascript application/x-javascript image/svg+xml;
#gzip_disable "MSIE [1-6]\.";
# Nginx default client_max_body_size is 1MB, which breaks Camera Upload feature from the phones.
# Increasing the limit fixes the issue. Anyhow, if 4K videos are expected to be uploaded, the size might need to be increased even more
@ -89,9 +89,9 @@
proxy_set_header X-Plex-Model $http_x_plex_model;
# Websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";
# Buffering off send to the client as soon as the data is received from Plex.
proxy_redirect off;
@ -106,4 +106,15 @@
systemd.services.plex.serviceConfig.TimeoutStartSec = "5m";
# restart plex weekly (needed to remain remotely available?!?!)
systemd.timers.restart-plex = {
wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = "weekly";
timerConfig.Unit = "restart-plex.service";
};
systemd.services.restart-plex = {
serviceConfig.Type = "oneshot";
serviceConfig.ExecStart = "systemctl restart plex.socket";
};
}