87 lines
2.7 KiB
Plaintext
87 lines
2.7 KiB
Plaintext
server {
|
||
listen 443 ssl;
|
||
http2 on;
|
||
server_name home.mashup.su www.home.mashup.su;
|
||
ssl_certificate /etc/letsencrypt/live/home.mashup.su/fullchain.pem;
|
||
ssl_certificate_key /etc/letsencrypt/live/home.mashup.su/privkey.pem;
|
||
|
||
ssl_protocols TLSv1.2 TLSv1.3;
|
||
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;
|
||
|
||
root /home/romkazvo/www;
|
||
|
||
# === КАСТОМНЫЕ СТРАНИЦЫ ОШИБОК ===
|
||
error_page 404 =404 /404.html;
|
||
location = /404.html {
|
||
root /home/romkazvo/www;
|
||
allow all;
|
||
}
|
||
|
||
error_page 403 =403 /403.html;
|
||
location = /403.html {
|
||
root /home/romkazvo/www;
|
||
allow all;
|
||
}
|
||
|
||
# === СТАТИКА ===
|
||
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|webp)$ {
|
||
expires 1y;
|
||
add_header Cache-Control "public, immutable";
|
||
try_files $uri =404;
|
||
}
|
||
|
||
# === СТРИМ /gachi ===
|
||
location = /gachi {
|
||
proxy_pass http://127.0.0.1:8001/;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_buffering off;
|
||
proxy_cache off;
|
||
proxy_read_timeout 3600;
|
||
proxy_send_timeout 3600;
|
||
add_header X-Stream-Name "Gachi Stream" always;
|
||
add_header Access-Control-Allow-Origin "*" always;
|
||
add_header Access-Control-Allow-Methods "GET, OPTIONS, HEAD" always;
|
||
add_header Access-Control-Allow-Headers "Range, Accept-Encoding" always;
|
||
}
|
||
|
||
# === CGI (с перехватом ошибок) ===
|
||
location /cgi-bin/ {
|
||
proxy_pass http://127.0.0.1:8050;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_http_version 1.1;
|
||
proxy_buffering off;
|
||
proxy_cache off;
|
||
proxy_read_timeout 300s;
|
||
proxy_send_timeout 300s;
|
||
proxy_intercept_errors on;
|
||
}
|
||
|
||
# === ВСЁ ОСТАЛЬНОЕ ===
|
||
location / {
|
||
proxy_pass http://127.0.0.1:8050;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_http_version 1.1;
|
||
proxy_buffering off;
|
||
proxy_cache off;
|
||
proxy_read_timeout 300s;
|
||
proxy_send_timeout 300s;
|
||
proxy_intercept_errors on;
|
||
}
|
||
}
|
||
|
||
# HTTP → HTTPS
|
||
server {
|
||
listen 80;
|
||
server_name home.mashup.su www.home.mashup.su;
|
||
return 301 https://$server_name$request_uri;
|
||
}
|