2022-11-17 14:47:25 +01:00
|
|
|
|
|
|
|
upstream backend {
|
2022-11-21 13:59:38 +01:00
|
|
|
server 127.0.0.1:{{http_port}};
|
2022-11-17 14:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
server_name {{domain}};
|
|
|
|
|
2023-09-02 13:13:28 +02:00
|
|
|
{% include 'roles/letsencrypt/templates/ssl_header.j2' %}
|
2022-11-17 14:47:25 +01:00
|
|
|
|
2023-11-18 20:02:55 +01:00
|
|
|
{% if nginx_matomo_tracking_active | default(False) %}
|
|
|
|
{% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
2022-11-17 14:47:25 +01:00
|
|
|
##
|
|
|
|
# Application
|
|
|
|
##
|
|
|
|
|
|
|
|
location @api {
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
|
|
|
client_max_body_size 100k; # default is 1M
|
|
|
|
|
|
|
|
proxy_connect_timeout 10m;
|
|
|
|
proxy_send_timeout 10m;
|
|
|
|
proxy_read_timeout 10m;
|
|
|
|
send_timeout 10m;
|
|
|
|
|
|
|
|
#adapt
|
|
|
|
proxy_pass http://127.0.0.1:{{http_port}};
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
try_files /dev/null @api;
|
|
|
|
}
|
|
|
|
|
|
|
|
location = /api/v1/videos/upload-resumable {
|
|
|
|
client_max_body_size 0;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
|
|
|
|
try_files /dev/null @api;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/api/v1/videos/(upload|([^/]+/studio/edit))$ {
|
|
|
|
limit_except POST HEAD { deny all; }
|
|
|
|
client_max_body_size 12G; # default is 1M
|
|
|
|
add_header X-File-Maximum-Size 8G always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
|
|
|
|
|
|
|
|
try_files /dev/null @api;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/api/v1/(videos|video-playlists|video-channels|users/me) {
|
|
|
|
client_max_body_size 6M; # default is 1M
|
|
|
|
add_header X-File-Maximum-Size 4M always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
|
|
|
|
|
|
|
|
try_files /dev/null @api;
|
|
|
|
}
|
|
|
|
|
|
|
|
##
|
|
|
|
# Websocket
|
|
|
|
##
|
|
|
|
|
|
|
|
location @api_websocket {
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
|
2022-11-21 12:18:28 +01:00
|
|
|
proxy_pass http://backend;
|
2022-11-17 14:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
location /socket.io {
|
|
|
|
try_files /dev/null @api_websocket;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /tracker/socket {
|
|
|
|
# Peers send a message to the tracker every 15 minutes
|
|
|
|
# Don't close the websocket before then
|
|
|
|
proxy_read_timeout 15m; # default is 60s
|
|
|
|
|
|
|
|
try_files /dev/null @api_websocket;
|
|
|
|
}
|
|
|
|
}
|