Doorgaan naar hoofdinhoud

Apache

Onofficiële Beta-vertaling

Deze pagina is vertaald door PageTurner AI (beta). Niet officieel goedgekeurd door het project. Een fout gevonden? Probleem melden →

"Het Apache HTTP Server Project is een initiatief om een open-source HTTP-server te ontwikkelen en onderhouden voor moderne besturingssystemen zoals UNIX en Windows. Het doel van dit project is om een veilige, efficiënte en uitbreidbare server te bieden die HTTP-diensten levert volgens de huidige HTTP-standaarden."

<VirtualHost *:80>
ServerName DOMAIN_NAME

# Comment to prevent HTTP to HTTPS redirect
Redirect permanent / https://DOMAIN_NAME/

ErrorLog /var/log/apache2/DOMAIN_NAME-error.log
CustomLog /var/log/apache2/DOMAIN_NAME-access.log combined
</VirtualHost>

# If you are not using a SSL certificate, replace the 'redirect'
# line above with all lines below starting with 'Proxy'
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName DOMAIN_NAME
# This folder exists just for certbot (You may have to create it, chown and chmod it to give apache permission to read it)
DocumentRoot /var/www/html/jellyfin/public_html

ProxyPreserveHost On

# Letsencrypt's certbot will place a file in this folder when updating/verifying certs
# This line will tell apache to not to use the proxy for this folder.
ProxyPass "/.well-known/" "!"

# Tell Jellyfin to forward requests that came from TLS connections
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"

# Apache should be able to know when to change protocols (between WebSocket and HTTP)
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://SERVER_IP_ADDRESS:8096/socket/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://SERVER_IP_ADDRESS:8096/$1 [P,L]

# Sometimes, Jellyfin requires clients to empty their cache to display and function correctly.
# This header tells clients not to keep any cache and is quite strict on that.
# This might also fix some syncplay issues (#5485 and #8140 @ https://github.com/jellyfin/jellyfin-web/issues/)
# Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/DOMAIN_NAME/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/DOMAIN_NAME/privkey.pem
Protocols h2 http/1.1

# Enable only strong encryption ciphers and prefer versions with Forward Secrecy
SSLCipherSuite HIGH:RC4-SHA:AES128-SHA:!aNULL:!MD5
SSLHonorCipherOrder on

# Disable insecure SSL and TLS versions
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1

ErrorLog /var/log/apache2/DOMAIN_NAME-error.log
CustomLog /var/log/apache2/DOMAIN_NAME-access.log combined
</VirtualHost>
</IfModule>

Als je fouten tegenkomt, moet je mogelijk mod_proxy, mod_ssl, proxy_wstunnel, http2, headers en remoteip handmatig inschakelen.

sudo a2enmod proxy proxy_http ssl proxy_wstunnel remoteip http2 headers

Apache met subpad (example.org/jellyfin)

Voer bij het verbinden met de server vanuit een clientapplicatie http(s)://DOMAIN_NAME/jellyfin in het adresveld in.

Stel het basis-URL veld in op de Jellyfin-server. Dit kan via het Beheerdersdashboard -> Netwerk -> Basis-URL in de webclient. Vul dit veld in met /jellyfin en klik op Opslaan. De server moet opnieuw worden opgestart voordat deze wijziging van kracht wordt.

let op

HTTP is onveilig. De volgende configuratie wordt alleen voor het gemak gegeven. Als je je server via internet beschikbaar wilt maken, moet je HTTPS instellen. Let's Encrypt biedt gratis TLS-certificaten die eenvoudig kunnen worden geïnstalleerd via certbot.

De volgende configuratie kan worden opgeslagen in /etc/httpd/conf/extra/jellyfin.conf en toegevoegd aan je vhost.

# Jellyfin hosted on http(s)://DOMAIN_NAME/jellyfin
<Location /jellyfin/socket>
ProxyPreserveHost On
ProxyPass "ws://127.0.0.1:8096/jellyfin/socket"
ProxyPassReverse "ws://127.0.0.1:8096/jellyfin/socket"
</Location>
<Location /jellyfin>
ProxyPass "http://127.0.0.1:8096/jellyfin"
ProxyPassReverse "http://127.0.0.1:8096/jellyfin"
</Location>