blob: 5eb4fefa21fe61d6d916492fb55541b347958d37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
server {
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name yummers.dev www.yummers.dev;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# Add WebSocket proxy for HR proxy server
location /hrproxy {
proxy_pass https://127.0.0.1:2096;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
include snippets/proxy-headers.conf;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_buffering off;
}
# OBS Proxy API endpoints
location /api/ {
limit_req zone=api_limit burst=20 nodelay;
proxy_pass http://127.0.0.1:5000;
include snippets/proxy-headers.conf;
}
# OBS Proxy HLS playlist + segments
location /hls/ {
limit_req zone=hls_limit burst=200 nodelay;
alias /var/www/streams/live/;
add_header Access-Control-Allow-Origin "*" always;
# Playlist files (.m3u8) should not be cached - they change constantly
location ~ \.m3u8$ {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Access-Control-Allow-Origin "*" always;
}
# Key files must never be cached client-side
location ~ \.key$ {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Access-Control-Allow-Origin "*" always;
}
# Segment files (.ts) can be cached - they're immutable
location ~ \.ts$ {
add_header Cache-Control "public, max-age=30" always;
add_header Access-Control-Allow-Origin "*" always;
}
autoindex off;
limit_except GET HEAD {
deny all;
}
}
# Add RTMP callbacks route (internal only)
location /rtmp_callbacks/ {
allow 127.0.0.1;
deny all;
proxy_pass http://127.0.0.1:5000;
include snippets/proxy-headers.conf;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/yummers.dev/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/yummers.dev/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.yummers.dev) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = yummers.dev) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name yummers.dev www.yummers.dev;
return 404; # managed by Certbot
}
|