Achim's picture

Hello,

 

I've installed the Turnkey Mediaserver which runs Jellyfin. I want to change the Port Jellyfin is listening too to Port 80. Currently Port 80 is occupied by the Control Panel. I tried to assign it another Port by editing /etc/apache2/ports.conf, but this was not successfull? Anyu advice, how to change the ports of both webservices would be welcome.

 

Many thanks in advance,


Achim

Forum: 
Jeremy Davis's picture

To fulfil your desire, you could change the port Apache is listening on. Alternatively, you could reconfigure Apache to reverse proxy Jellyfin. That may be worth further investigation as it may be easier to set up?

Regardless, as you are explicitly asked about changing the Jellyfin port, you need to stop Apache listening on port 80 (only one protocol can use any one port).

By default (on Debian) the Apache ports are configured in /etc/apache/ports.conf. To disable Apache from listening on port 80, comment out the relevant line in ports.conf. I.e. change this line:

Listen 80

To this:

#Listen 80

Now restart Apache to apply the new config:

systemctl restart apache2

And now port 80 should be free for use by something else, such as Jellyfin.

Please be aware though, it's quite likely that you will now likely hit a new issue. Jellyfin runs as a 'standard' (unprivileged) user, which is exactly what you want for security. But as the name suggests; to bind to a "privileged port" (i.e. ports numbered 1023 and below) you must be running as a privileged user (i.e. root).

Webservers such as Apache work around this by initially starting as root (to bind the port) then starting forked processes owned by a 'standard' user (usually 'www-data') that actually do the work. So unless you run Jellyfin as root (a really bad idea!) then you'll need to work around that problem.

There are a few different ways to do that, but my personal preference is a tool known as authbind. Here is a ServerFault Answer that I wrote ages ago, giving an example of how to allow a NodeJS app running as 'user' to bind to port 80. The same theory applies would apply in your case; but you'll need to use the user that Jellyfin runs under (IIRC it's 'jellyfin' but please double check).

The final part of the config to apply would be to adjust the Jellyfin service to run 'authbind jellyfin OTHER_ARGS' (i.e. add the 'authbind' prefix to whatever command it uses to start Jellyfin).

Good luck!

aubreynicoricbuma's picture

Almost in disbelief.  

 

Your answer to this question was to the point yet incredibly detailed with explanations, supporting information, and sources to continue learning about the topic.  

This is one of the most helpful things I've ever seen on the internet.  

Good job!  Keep it up!

Jack macusa's picture

You can reconfigure apache to reverse proxy settings. It should work then.

Add new comment