Created
January 30, 2022 12:53
-
-
Save pradiptabasu/4d7f7f7fa8fef1740e87f8543ca56a48 to your computer and use it in GitHub Desktop.
Nginx configuration for Emby Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80; | |
| server_name | |
| media.yourdomain.com | |
| media.int.yourdomain.com | |
| ; | |
| root /var/www/html; | |
| return 301 https://$server_name$request_uri; | |
| } | |
| server { | |
| listen 443 ssl; | |
| server_name | |
| media.yourdomain.com | |
| media.int.yourdomain.com | |
| ; | |
| if ($host !~ ^media(\.int)?\.yourdomain\.com$) { | |
| return 444; | |
| } | |
| root /var/www/html/emby; | |
| ssl_certificate /etc/letsencrypt/live/media.yourdomain.com/fullchain.pem; | |
| ssl_certificate_key /etc/letsencrypt/live/media.yourdomain.com/privkey.pem; | |
| error_page 502 @502; | |
| error_page 503 @503; | |
| location = / { | |
| return 301 https://$server_name/web/index.html; | |
| } | |
| location / { | |
| try_files $uri $uri/ @backend; | |
| } | |
| location @backend { | |
| proxy_pass http://127.0.0.1:5200; | |
| # Allow WebSocket connections via HTTP 201 | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| proxy_set_header X-Forwarded-Host $host; | |
| proxy_set_header X-Forwarded-Server $host; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_redirect off; | |
| } | |
| location @502 { | |
| try_files /unavailable.html =502; | |
| } | |
| location @503 { | |
| try_files /unavailable.html =503; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment