Ir al contenido principal

Apache

Traducción Beta No Oficial

Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →

"El Proyecto del Servidor HTTP Apache es un esfuerzo para desarrollar y mantener un servidor HTTP de código abierto para sistemas operativos modernos, incluidos UNIX y Windows. El objetivo de este proyecto es proporcionar un servidor seguro, eficiente y extensible que ofrezca servicios HTTP acordes con los estándares HTTP actuales."

<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>

Si encuentras errores, es posible que necesites habilitar manualmente los módulos mod_proxy, mod_ssl, proxy_wstunnel, http2, headers y remoteip.

sudo a2enmod proxy proxy_http ssl proxy_wstunnel remoteip http2 headers

Apache con subruta (ejemplo.org/jellyfin)

Al conectarte al servidor desde una aplicación cliente, ingresa http(s)://DOMAIN_NAME/jellyfin en el campo de dirección.

Configura el campo URL base en el servidor Jellyfin. Esto se hace navegando al Panel de administración -> Red -> URL base en el cliente web. Rellena este campo con /jellyfin y haz clic en Guardar. El servidor necesitará reiniciarse para aplicar este cambio.

precaución

HTTP no es seguro. La siguiente configuración se proporciona únicamente por facilidad de uso. Si planeas exponer tu servidor en Internet, debes configurar HTTPS. Let's Encrypt puede proporcionar certificados TLS gratuitos que se instalan fácilmente mediante certbot.

La siguiente configuración puede guardarse en /etc/httpd/conf/extra/jellyfin.conf e incluirse en tu virtual host.

# 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>