Files
linearvoid/infrastructure/nginx/nginx.conf
T
zwitschi 6b494a34fe
CD / deploy (push) Failing after 27s
CI / test (push) Successful in 1m54s
CI / docker (push) Canceled after 0s
CI / release (push) Canceled after 0s
feat: add admin login page and authentication API
- Created a new login page for admin access at frontend/admin/login/index.html.
- Implemented form submission with error handling for login credentials.
- Updated frontend/index.html to mute the video player and removed unnecessary Alpine.js data binding.
- Enhanced manifest URL resolution in frontend/src/main.ts to include cache-busting parameters.
- Modified vite.config.ts to include the new admin login page in the build process.
- Updated nginx.conf to handle admin login routing, authentication, and API proxying for admin actions.
2026-08-03 17:19:05 +02:00

190 lines
6.1 KiB
Nginx Configuration File

events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
resolver 127.0.0.11 ipv6=off valid=30s;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name www.linearvoid.tv;
return 301 https://linearvoid.tv$request_uri;
}
server {
listen 80 default_server;
server_name linearvoid.tv localhost 127.0.0.1;
root /srv/frontend;
index index.html;
location = /admin {
return 301 /admin/;
}
location = /admin/login {
return 301 /admin/login/;
}
location = /_admin_auth {
internal;
set $chat_upstream http://chat:3000;
proxy_pass $chat_upstream/api/admin/session;
proxy_http_version 1.1;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header Cookie $http_cookie;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /admin/login/ {
try_files $uri $uri/ /admin/login/index.html;
}
location /admin/ {
auth_request /_admin_auth;
error_page 401 = @admin_login_redirect;
try_files $uri $uri/ /admin/index.html;
}
location /assets/ {
try_files $uri =404;
}
# Serve static frontend
location / {
try_files $uri $uri/ /index.html;
}
# Proxy chat WebSocket
location /ws {
set $chat_upstream http://chat:3000;
proxy_pass $chat_upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location = /api/admin/login {
set $chat_upstream http://chat:3000;
proxy_pass $chat_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
}
location = /api/admin/logout {
set $chat_upstream http://chat:3000;
proxy_pass $chat_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
}
location = /api/admin/session {
set $chat_upstream http://chat:3000;
proxy_pass $chat_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
}
location /api/admin/ {
auth_request /_admin_auth;
error_page 401 = @admin_api_unauthorized;
set $chat_upstream http://chat:3000;
proxy_pass $chat_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
}
location /api/ {
set $chat_upstream http://chat:3000;
proxy_pass $chat_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location = /metrics {
set $chat_upstream http://chat:3000;
proxy_pass $chat_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location @admin_api_unauthorized {
add_header Content-Type application/json;
return 401 '{"error":"unauthorized"}';
}
location @admin_login_redirect {
return 302 /admin/login/;
}
location = /hls/playlist.m3u8 {
alias /srv/hls/playlist.m3u8;
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
add_header Access-Control-Allow-Origin "*";
}
location = /hls/init.mp4 {
alias /srv/hls/init.mp4;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Access-Control-Allow-Origin "*";
}
location ~* ^/hls/(.+\.(ts|m4s))$ {
alias /srv/hls/$1;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Access-Control-Allow-Origin "*";
}
# Local/dev fallback HLS origin. Production media should use MEDIA_DOMAIN.
location /hls/ {
alias /srv/hls/;
add_header Cache-Control "public, max-age=60";
add_header Access-Control-Allow-Origin "*";
}
# Health checks
location /health {
return 200 "healthy";
add_header Content-Type text/plain;
}
}
}