2021-03-03 14:33:50 +01:00
|
|
|
daemon off;
|
2021-09-21 02:02:59 +02:00
|
|
|
user root;
|
2022-12-18 00:53:34 +01:00
|
|
|
worker_processes auto;
|
2020-11-02 12:44:16 +01:00
|
|
|
|
2022-12-18 00:53:34 +01:00
|
|
|
error_log /dev/stdout warn;
|
|
|
|
pid /var/run/nginx.pid;
|
2020-11-02 12:44:16 +01:00
|
|
|
|
|
|
|
events {
|
2022-12-18 00:53:34 +01:00
|
|
|
worker_connections 1024;
|
2020-11-02 12:44:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
2022-12-18 00:53:34 +01:00
|
|
|
include mime.types;
|
|
|
|
default_type application/octet-stream;
|
2020-11-02 12:44:16 +01:00
|
|
|
|
2022-12-18 00:53:34 +01:00
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
2020-11-02 12:44:16 +01:00
|
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
|
2022-12-18 00:53:34 +01:00
|
|
|
access_log /dev/stdout main;
|
2020-11-02 12:44:16 +01:00
|
|
|
|
2022-12-18 00:53:34 +01:00
|
|
|
# send headers in one piece, it is better than sending them one by one
|
|
|
|
tcp_nopush on;
|
2020-11-02 12:44:16 +01:00
|
|
|
|
2022-12-18 00:53:34 +01:00
|
|
|
sendfile on;
|
|
|
|
|
|
|
|
keepalive_timeout 65;
|
2020-11-02 12:44:16 +01:00
|
|
|
|
2021-01-29 06:04:52 +01:00
|
|
|
gzip on;
|
|
|
|
gzip_comp_level 6;
|
|
|
|
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/javascript image/svg+xml image/x-icon image/bmp image/png image/gif image/jpeg image/jpg;
|
|
|
|
gzip_proxied no-cache no-store private expired auth;
|
|
|
|
gzip_vary on;
|
|
|
|
|
2020-11-08 23:35:21 +01:00
|
|
|
upstream frigate_api {
|
2022-12-18 00:53:34 +01:00
|
|
|
server 127.0.0.1:5001;
|
|
|
|
keepalive 1024;
|
2020-11-08 23:35:21 +01:00
|
|
|
}
|
2020-11-02 12:44:16 +01:00
|
|
|
|
2021-06-14 14:31:13 +02:00
|
|
|
upstream mqtt_ws {
|
2022-12-18 00:53:34 +01:00
|
|
|
server 127.0.0.1:5002;
|
|
|
|
keepalive 1024;
|
2021-06-14 14:31:13 +02:00
|
|
|
}
|
|
|
|
|
2021-03-02 13:54:12 +01:00
|
|
|
upstream jsmpeg {
|
2022-12-18 00:53:34 +01:00
|
|
|
server 127.0.0.1:8082;
|
|
|
|
keepalive 1024;
|
2021-03-02 13:54:12 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 12:36:09 +01:00
|
|
|
upstream go2rtc {
|
|
|
|
server 127.0.0.1:1984;
|
|
|
|
keepalive 1024;
|
|
|
|
}
|
|
|
|
|
2020-11-02 12:44:16 +01:00
|
|
|
server {
|
2020-11-09 14:30:44 +01:00
|
|
|
listen 5000;
|
2020-11-02 12:44:16 +01:00
|
|
|
|
2021-05-18 07:52:08 +02:00
|
|
|
# vod settings
|
2021-06-03 18:17:08 +02:00
|
|
|
vod_base_url '';
|
|
|
|
vod_segments_base_url '';
|
2021-05-18 07:52:08 +02:00
|
|
|
vod_mode mapped;
|
|
|
|
vod_max_mapping_response_size 1m;
|
|
|
|
vod_upstream_location /api;
|
2021-08-29 04:26:23 +02:00
|
|
|
vod_align_segments_to_key_frames on;
|
|
|
|
vod_manifest_segment_durations_mode accurate;
|
2022-08-26 13:33:16 +02:00
|
|
|
vod_ignore_edit_list on;
|
2022-12-18 00:53:34 +01:00
|
|
|
vod_segment_duration 10000;
|
|
|
|
vod_hls_mpegts_align_frames off;
|
|
|
|
vod_hls_mpegts_interleave_frames on;
|
|
|
|
|
|
|
|
# file handle caching / aio
|
|
|
|
open_file_cache max=1000 inactive=5m;
|
|
|
|
open_file_cache_valid 2m;
|
|
|
|
open_file_cache_min_uses 1;
|
|
|
|
open_file_cache_errors on;
|
|
|
|
aio on;
|
|
|
|
|
|
|
|
# https://github.com/kaltura/nginx-vod-module#vod_open_file_thread_pool
|
|
|
|
vod_open_file_thread_pool default;
|
2021-05-18 07:52:08 +02:00
|
|
|
|
|
|
|
# vod caches
|
|
|
|
vod_metadata_cache metadata_cache 512m;
|
2021-12-12 15:03:38 +01:00
|
|
|
vod_mapping_cache mapping_cache 5m 10m;
|
2021-05-18 07:52:08 +02:00
|
|
|
|
|
|
|
# gzip manifests
|
|
|
|
gzip on;
|
|
|
|
gzip_types application/vnd.apple.mpegurl;
|
|
|
|
|
|
|
|
location /vod/ {
|
2022-12-18 00:53:34 +01:00
|
|
|
aio threads;
|
2021-05-18 07:52:08 +02:00
|
|
|
vod hls;
|
|
|
|
|
2021-07-13 03:54:12 +02:00
|
|
|
secure_token $args;
|
2022-12-18 00:53:34 +01:00
|
|
|
secure_token_types application/vnd.apple.mpegurl;
|
2021-07-13 03:54:12 +02:00
|
|
|
|
2022-04-25 15:00:01 +02:00
|
|
|
add_header Cache-Control "no-store";
|
|
|
|
expires off;
|
2021-05-18 07:52:08 +02:00
|
|
|
}
|
|
|
|
|
2020-11-02 12:44:16 +01:00
|
|
|
location /stream/ {
|
2022-04-25 15:00:01 +02:00
|
|
|
add_header Cache-Control "no-store";
|
|
|
|
expires off;
|
2020-11-02 12:44:16 +01:00
|
|
|
|
|
|
|
types {
|
|
|
|
application/dash+xml mpd;
|
|
|
|
application/vnd.apple.mpegurl m3u8;
|
|
|
|
video/mp2t ts;
|
|
|
|
image/jpeg jpg;
|
|
|
|
}
|
|
|
|
|
|
|
|
root /tmp;
|
|
|
|
}
|
|
|
|
|
2020-11-08 23:35:21 +01:00
|
|
|
location /clips/ {
|
2020-11-02 12:44:16 +01:00
|
|
|
|
|
|
|
types {
|
|
|
|
video/mp4 mp4;
|
|
|
|
image/jpeg jpg;
|
|
|
|
}
|
|
|
|
|
|
|
|
autoindex on;
|
2020-11-08 23:35:21 +01:00
|
|
|
root /media/frigate;
|
|
|
|
}
|
|
|
|
|
2021-08-10 15:27:31 +02:00
|
|
|
location /cache/ {
|
2022-12-18 00:53:34 +01:00
|
|
|
internal; # This tells nginx it's not accessible from the outside
|
|
|
|
alias /tmp/cache/;
|
2021-08-10 15:27:31 +02:00
|
|
|
}
|
|
|
|
|
2020-11-30 14:56:19 +01:00
|
|
|
location /recordings/ {
|
2023-06-08 13:32:35 +02:00
|
|
|
types {
|
|
|
|
video/mp4 mp4;
|
|
|
|
}
|
|
|
|
|
|
|
|
autoindex on;
|
|
|
|
autoindex_format json;
|
|
|
|
root /media/frigate;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /exports/ {
|
2020-11-30 14:56:19 +01:00
|
|
|
types {
|
|
|
|
video/mp4 mp4;
|
|
|
|
}
|
|
|
|
|
|
|
|
autoindex on;
|
|
|
|
autoindex_format json;
|
|
|
|
root /media/frigate;
|
|
|
|
}
|
|
|
|
|
2021-02-13 15:09:44 +01:00
|
|
|
location /ws {
|
2021-06-14 14:31:13 +02:00
|
|
|
proxy_pass http://mqtt_ws/;
|
2023-10-21 15:15:24 +02:00
|
|
|
include proxy.conf;
|
2021-02-13 15:09:44 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 12:36:09 +01:00
|
|
|
location /live/jsmpeg/ {
|
2021-03-02 13:54:12 +01:00
|
|
|
proxy_pass http://jsmpeg/;
|
2023-10-21 15:15:24 +02:00
|
|
|
include proxy.conf;
|
2021-03-02 13:54:12 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 12:36:09 +01:00
|
|
|
location /live/mse/ {
|
|
|
|
proxy_pass http://go2rtc/;
|
2023-10-21 15:15:24 +02:00
|
|
|
include proxy.conf;
|
2022-11-02 12:36:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
location /live/webrtc/ {
|
|
|
|
proxy_pass http://go2rtc/;
|
2023-10-21 15:15:24 +02:00
|
|
|
include proxy.conf;
|
2022-11-02 12:36:09 +01:00
|
|
|
}
|
|
|
|
|
2023-05-05 04:04:06 +02:00
|
|
|
location ~* /api/go2rtc([/]?.*)$ {
|
|
|
|
proxy_pass http://go2rtc;
|
|
|
|
rewrite ^/api/go2rtc(.*)$ /api$1 break;
|
2023-10-21 15:15:24 +02:00
|
|
|
include proxy.conf;
|
2023-05-05 04:04:06 +02:00
|
|
|
}
|
|
|
|
|
2022-08-25 14:32:30 +02:00
|
|
|
location ~* /api/.*\.(jpg|jpeg|png)$ {
|
|
|
|
rewrite ^/api/(.*)$ $1 break;
|
|
|
|
proxy_pass http://frigate_api;
|
2023-10-21 15:15:24 +02:00
|
|
|
include proxy.conf;
|
2022-04-25 15:00:01 +02:00
|
|
|
}
|
|
|
|
|
2021-01-09 18:26:46 +01:00
|
|
|
location /api/ {
|
2022-04-25 15:00:01 +02:00
|
|
|
add_header Cache-Control "no-store";
|
|
|
|
expires off;
|
2020-11-08 23:35:21 +01:00
|
|
|
proxy_pass http://frigate_api/;
|
2023-10-21 15:15:24 +02:00
|
|
|
include proxy.conf;
|
|
|
|
|
|
|
|
location /api/stats {
|
|
|
|
access_log off;
|
|
|
|
add_header Cache-Control "no-store";
|
|
|
|
expires off;
|
|
|
|
proxy_pass http://frigate_api/;
|
|
|
|
include proxy.conf;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /api/version {
|
|
|
|
access_log off;
|
|
|
|
add_header Cache-Control "no-store";
|
|
|
|
expires off;
|
|
|
|
proxy_pass http://frigate_api/;
|
|
|
|
include proxy.conf;
|
|
|
|
}
|
2020-11-02 12:44:16 +01:00
|
|
|
}
|
2021-01-09 18:26:46 +01:00
|
|
|
|
|
|
|
location / {
|
2022-04-25 15:00:01 +02:00
|
|
|
add_header Cache-Control "no-store";
|
|
|
|
expires off;
|
2021-01-29 06:04:52 +01:00
|
|
|
|
2022-04-25 15:00:01 +02:00
|
|
|
location /assets/ {
|
2021-01-29 06:04:52 +01:00
|
|
|
access_log off;
|
|
|
|
expires 1y;
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
}
|
|
|
|
|
2022-05-19 14:31:02 +02:00
|
|
|
sub_filter 'href="/BASE_PATH/' 'href="$http_x_ingress_path/';
|
|
|
|
sub_filter 'url(/BASE_PATH/' 'url($http_x_ingress_path/';
|
|
|
|
sub_filter '"/BASE_PATH/dist/' '"$http_x_ingress_path/dist/';
|
|
|
|
sub_filter '"/BASE_PATH/js/' '"$http_x_ingress_path/js/';
|
|
|
|
sub_filter '"/BASE_PATH/assets/' '"$http_x_ingress_path/assets/';
|
2022-12-18 00:55:41 +01:00
|
|
|
sub_filter '"/BASE_PATH/monacoeditorwork/' '"$http_x_ingress_path/assets/';
|
2022-11-17 14:05:27 +01:00
|
|
|
sub_filter 'return"/BASE_PATH/"' 'return window.baseUrl';
|
2022-05-19 14:31:02 +02:00
|
|
|
sub_filter '<body>' '<body><script>window.baseUrl="$http_x_ingress_path/";</script>';
|
2021-01-20 02:58:17 +01:00
|
|
|
sub_filter_types text/css application/javascript;
|
|
|
|
sub_filter_once off;
|
2021-01-29 06:04:52 +01:00
|
|
|
|
2021-01-20 02:58:17 +01:00
|
|
|
root /opt/frigate/web;
|
|
|
|
try_files $uri $uri/ /index.html;
|
2021-01-09 18:26:46 +01:00
|
|
|
}
|
2020-11-02 12:44:16 +01:00
|
|
|
}
|
2020-11-28 14:58:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
rtmp {
|
|
|
|
server {
|
|
|
|
listen 1935;
|
|
|
|
chunk_size 4096;
|
|
|
|
allow publish 127.0.0.1;
|
|
|
|
deny publish all;
|
|
|
|
allow play all;
|
|
|
|
application live {
|
|
|
|
live on;
|
|
|
|
record off;
|
|
|
|
meta copy;
|
|
|
|
}
|
|
|
|
}
|
2022-12-18 00:53:34 +01:00
|
|
|
}
|