2020-11-02 12:44:16 +01:00
|
|
|
worker_processes 1;
|
|
|
|
|
2021-05-18 07:52:08 +02:00
|
|
|
error_log /usr/local/nginx/logs/error.log warn;
|
2020-11-02 12:44:16 +01:00
|
|
|
pid /var/run/nginx.pid;
|
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
2021-05-18 07:52:08 +02:00
|
|
|
include mime.types;
|
2020-11-02 12:44:16 +01:00
|
|
|
default_type application/octet-stream;
|
|
|
|
|
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
|
2021-05-18 07:52:08 +02:00
|
|
|
access_log /usr/local/nginx/logs/access.log main;
|
2020-11-02 12:44:16 +01:00
|
|
|
|
|
|
|
sendfile on;
|
|
|
|
|
|
|
|
keepalive_timeout 65;
|
|
|
|
|
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 {
|
2020-11-09 14:30:44 +01:00
|
|
|
server localhost:5001;
|
2020-11-08 23:35:21 +01:00
|
|
|
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
|
|
|
|
vod_mode mapped;
|
|
|
|
vod_max_mapping_response_size 1m;
|
|
|
|
vod_upstream_location /api;
|
|
|
|
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
|
|
|
|
vod_last_modified_types *;
|
|
|
|
|
|
|
|
# vod caches
|
|
|
|
vod_metadata_cache metadata_cache 512m;
|
|
|
|
vod_response_cache response_cache 128m;
|
|
|
|
vod_mapping_cache mapping_cache 5m;
|
|
|
|
|
|
|
|
# gzip manifests
|
|
|
|
gzip on;
|
|
|
|
gzip_types application/vnd.apple.mpegurl;
|
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
|
|
|
location /vod/ {
|
|
|
|
vod hls;
|
|
|
|
|
|
|
|
add_header Access-Control-Allow-Headers '*';
|
|
|
|
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
|
|
|
|
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
|
|
|
|
add_header Access-Control-Allow-Origin '*';
|
|
|
|
expires 100d;
|
|
|
|
}
|
|
|
|
|
2020-11-02 12:44:16 +01:00
|
|
|
location /stream/ {
|
|
|
|
add_header 'Cache-Control' 'no-cache';
|
|
|
|
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
|
|
|
add_header 'Access-Control-Allow-Credentials' 'true';
|
|
|
|
add_header 'Access-Control-Expose-Headers' 'Content-Length';
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
|
|
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
|
|
|
add_header 'Access-Control-Max-Age' 1728000;
|
|
|
|
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
|
|
|
add_header 'Content-Length' 0;
|
|
|
|
return 204;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
|
|
|
add_header 'Access-Control-Allow-Credentials' 'true';
|
|
|
|
add_header 'Access-Control-Expose-Headers' 'Content-Length';
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
|
|
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
|
|
|
add_header 'Access-Control-Max-Age' 1728000;
|
|
|
|
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
|
|
|
add_header 'Content-Length' 0;
|
|
|
|
return 204;
|
|
|
|
}
|
|
|
|
|
|
|
|
types {
|
|
|
|
video/mp4 mp4;
|
|
|
|
image/jpeg jpg;
|
|
|
|
}
|
|
|
|
|
|
|
|
autoindex on;
|
2020-11-08 23:35:21 +01:00
|
|
|
root /media/frigate;
|
|
|
|
}
|
|
|
|
|
2020-11-30 14:56:19 +01:00
|
|
|
location /recordings/ {
|
|
|
|
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
|
|
|
add_header 'Access-Control-Allow-Credentials' 'true';
|
|
|
|
add_header 'Access-Control-Expose-Headers' 'Content-Length';
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
|
|
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
|
|
|
add_header 'Access-Control-Max-Age' 1728000;
|
|
|
|
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
|
|
|
add_header 'Content-Length' 0;
|
|
|
|
return 204;
|
|
|
|
}
|
|
|
|
|
|
|
|
types {
|
|
|
|
video/mp4 mp4;
|
|
|
|
}
|
|
|
|
|
|
|
|
autoindex on;
|
|
|
|
autoindex_format json;
|
|
|
|
root /media/frigate;
|
|
|
|
}
|
|
|
|
|
2021-02-13 15:09:44 +01:00
|
|
|
location /ws {
|
|
|
|
proxy_pass http://frigate_api/ws;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "Upgrade";
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
}
|
|
|
|
|
2021-01-09 18:26:46 +01:00
|
|
|
location /api/ {
|
|
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
2021-05-12 17:19:02 +02:00
|
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
2021-01-29 06:04:52 +01:00
|
|
|
add_header Cache-Control "no-store";
|
2020-11-08 23:35:21 +01:00
|
|
|
proxy_pass http://frigate_api/;
|
|
|
|
proxy_pass_request_headers on;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2020-11-02 12:44:16 +01:00
|
|
|
}
|
2021-01-09 18:26:46 +01:00
|
|
|
|
2021-01-29 06:04:52 +01:00
|
|
|
|
2021-01-09 18:26:46 +01:00
|
|
|
location / {
|
2021-01-29 06:04:52 +01:00
|
|
|
add_header Cache-Control "no-cache";
|
|
|
|
|
|
|
|
location ~* \.(?:js|css|svg|ico|png)$ {
|
|
|
|
access_log off;
|
|
|
|
expires 1y;
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
}
|
|
|
|
|
2021-01-20 02:58:17 +01:00
|
|
|
sub_filter 'href="/' 'href="$http_x_ingress_path/';
|
|
|
|
sub_filter 'url(/' 'url($http_x_ingress_path/';
|
2021-02-08 18:48:34 +01:00
|
|
|
sub_filter '"/dist/' '"$http_x_ingress_path/dist/';
|
2021-01-20 02:58:17 +01:00
|
|
|
sub_filter '"/js/' '"$http_x_ingress_path/js/';
|
|
|
|
sub_filter '<body>' '<body><script>window.baseUrl="$http_x_ingress_path";</script>';
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2021-01-09 18:26:46 +01:00
|
|
|
}
|