Jellyfin + https + nginx setting up

Hello. Almost totally noob here.

Rapsberry Pi 4 8GB.

Now I have a setup with nextcloud(https using letsencrypt as per Joulinar guide in this forum) + Sonarr + Radarr + Bazarr + Jackett + qBitTorret + PiVPN + Jellyfin. Everything is working fine.

However, I’d like to access Jellyfin from outside my home.

I ready read forum posts like

https://dietpi.com/forum/t/enabling-https-on-jellyfin/4494/4
https://dietpi.com/forum/t/one-letsencrypt-certificate-for-all-installed-applications/4886/1

and some tutorials, blog posts, etc .

After the research I guess my first step is change my default web server from lighttpd to nginx, but dietpi-software indicates that I can’t without unistalling all the web applications.

So, I’m stuck. How should I proceed? Maybe using the ngixproxymanager docker container that Joulinar pointed in his post? Can this get along with my installation?

And, could you please point me to a noob guide to get all this working?

Thank you in advance

Hi,

there will be no easy to go like a noob, give me all commands and I will copy them into command line, solutions :wink:

There are a couple of decisions to be done. And you would need to decide what will best for you.

Looking to your applications, Sonarr + Radarr + Bazarr + Jackett + qBitTorret, all running own web server and are not depending on Lighttpd or Nginx. Means they are not impacted. If I understood correctly, it’s not planned to make them available and accessible from the internet.

PiVPN is not a web server application. It’s a VPN server and not impacted at all.

This will left us with Nextcloud and Jellyfin. Depending on the amount of data and configuration already done, it might be a possible way to re-setup both from scratch on Nginx. But this would be up to you to decide.

If it is not possible to reinstall Nextcloud and Jellyfin, you could install Nginx next to Lighttpd. Would be something to test how letsencrypt is behaving if both are installed :thinking:

NginxProxyManager would be an easy way to mange multiple SSL certificates and sites to be available from internet. It’s quite a heavy solution as you need docker + database. It might be a little bit oversized if you like to access Nextcloud + Jellyfin only.

A reverse proxy can btw as easily be added with Apache2 or Lighttpd:
E.g. for Apache2 to access via your.IP/jellyfin:

a2enmod proxy
cat << 'EOF' > /etc/apache2/sites-available/jellyfin.conf
ProxyPass /jellyfin http://127.0.0.1:8096/
ProxyPassReverse /jellyfin http://127.0.0.1:8096/
EOF
a2ensite jellyfin
systemctl restart apache2

Lighttpd:

lighty-enable-mod proxy
cat << 'EOF' > /etc/lighttpd/conf-available/99-jellyfin.conf
$HTTP["url"] =~ "^/jellyfin" {
    proxy.header = ( "map-urlpath" => ( "/jellyfin" => "/" ) )
    proxy.server = ( "" =>  ( ( "host" => "127.0.0.1", "port" => 8096 ) ) )
}
EOF
lighty-enable-mod jellyfin
systemctl restart lighttpd

We need to add this to our docs :slight_smile:: https://github.com/MichaIng/DietPi-Docs/issues/404

probably we need a section for all 3 web server on this revers proxy topic. :thinking:

Either that or a reverse proxy tab or each webservers documentation. But actually I like your combined idea more as it can then be easily linked from every web applications section that runs on its own port.

yeah but I’m totally noob if it comes down to revers proxy config :roll_eyes:
Always struggling with it

Apache2 makes it very easy and intuitive, as mostly, but on Lighttpd I forgot the need for (and just added) the path mapping so that it’s not proxied to 127.0.0.1:8096/jellyfin. While Apache2 was not designed as proxy in the first place, like Nginx, and probably does not achieve same performance on high loads, I love it’s very simple and clean syntax :slight_smile:.

some small corrections related to what MichaIng proposed

create config file as follow. Path is conf-available and not mods-available

cat << 'EOF' > /etc/lighttpd/conf-available/99-jellyfin.conf
$HTTP["url"] =~ "^/jellyfin" {
    proxy.header = ( "map-urlpath" => ( "/jellyfin" => "/" ) )
    proxy.server = ( "" =>  ( ( "host" => "127.0.0.1", "port" => 8096 ) ) )
}
EOF

activate setting

lighty-enable-mod proxy
lighty-enable-mod jellyfin
systemctl restart lighttpd

MichaIng
I end up with the following. Maybe it is not that simple :thinking:

So the Jellyfin UI is reached at least, but it seems to have internal issues with the proxy. Does it work OOTB with Nginx?

There are some other options: https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModProxy
Probably adding the X-Forwarded-For ans X-Forwarded-Proto helps, which AFAIK is done by default by Nginx and Apache2.
EDIT: Apache2 adds X-Forwarded-Server as well.

need to run some test on weekend.

Following up on this. Did anyone get this to work with lighttpd?

did you tried this solution for lighttpd

https://dietpi.com/forum/t/jellyfin-https-nginx-setting-up/5127/3

Yes, it did work to some extent. Now I am getting the following error. The issue must be with X-Forward but I don’t know how to set it up in Lighttpd.

Here is the solution for nginx. https://jellyfin.org/docs/general/networking/nginx.html

ah right we had the same issue but did not find a solution. Unfortunately lighttpd is not the best choice to run a revers proxy.

I guess something like the socket would need to be forward as well, looking to the other proxy configuration


EDIT: I played with it and at least I got it working for myself if I set a base URL /jellyfin inside Jellyfin configuration panel. That’s within the network section.

lighttpd config file is like this.

root@DietPiVM-H:~# cat /etc/lighttpd/conf-available/99-jellyfin.conf
$HTTP["url"] =~ "^/jellyfin" {
        proxy.server = ( "" =>  ( ( "host" => "127.0.0.1", "port" => 8096 ) ) )
}root@DietPiVM-H:~#

Thanks will check this out and let you know.

Yes, this worked. Thanks a lot. Downside is that it is putting too much load on my raspberry pi 4 and hence creating lag in watching videos. The proxy is on raspberry pi and the host is a windows desktop machine (i5 with graphics card). Not sure if this is a viable solution. Without proxy the video performance is great. Thanks once again!

try to watch htop to see what is causing the load

it is due to the Lighttpd process.

indeed, seems the proxy is not really able to deal with the lead. Not sure if there is a way to rune this or how other proxy web server, like nginx, might behave.

I can try nginx and post my feedback here but I would need help with the config file for that. Is it possible for you to post an example of the config file ?

The default nginx jellyfin config file didn’t work for me.

https://jellyfin.org/docs/general/networking/nginx.html