initial commit
This commit is contained in:
68
configuration/nginx/backup.nix
Normal file
68
configuration/nginx/backup.nix
Normal file
@@ -0,0 +1,68 @@
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
additionalModules = [ pkgs.nginxModules.rtmp ];
|
||||
|
||||
appendConfig = ''
|
||||
rtmp {
|
||||
server {
|
||||
listen 1935;
|
||||
chunk_size 1024;
|
||||
application stream {
|
||||
live on;
|
||||
meta copy;
|
||||
hls on;
|
||||
hls_path /var/www/html/stream/hls;
|
||||
hls_playlist_length 10s;
|
||||
hls_fragment 1s;
|
||||
dash on;
|
||||
dash_path /var/www/html/stream/dash;
|
||||
allow publish all;
|
||||
allow play all;
|
||||
on_publish http://127.0.0.1:8000/publish;
|
||||
on_publish_done http://127.0.0.1:8000/unpublish;
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
||||
virtualHosts."main" = {
|
||||
listen = [ {addr = "0.0.0.0"; port = 80; } ];
|
||||
locations = {
|
||||
"/" = {
|
||||
root = ./html;
|
||||
index = "index.html";
|
||||
};
|
||||
# "/rtmp_stat" = {
|
||||
# rtmp_stat = "all";
|
||||
# rtmp_stat_stylesheet = "/stat.xsl";
|
||||
# };
|
||||
"/hls" = {
|
||||
# types = {
|
||||
# "application/vnd.apple.mpegurl" = "m3u8";
|
||||
# "video/mp2t" = "ts";
|
||||
# };
|
||||
root = "/tmp";
|
||||
};
|
||||
"/dash" = {
|
||||
root = "/tmp";
|
||||
};
|
||||
"/watch" = {
|
||||
root = "/usr/local/nginx/html";
|
||||
# try_files = "$uri /watch/index.html";
|
||||
};
|
||||
# # some issue with the go server not handeling this well even with prefix (in config.toml) set correctly
|
||||
# "/auth" = {
|
||||
# basicAuth.admin = "123g";
|
||||
# proxyPass = "http://localhost:${toString config.services.rtmp-auth.frontendPort}/auth";
|
||||
# };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/www/html/stream/hls 0755 ${config.services.nginx.user} ${config.services.nginx.user} - -"
|
||||
"d /var/www/html/stream/dash 0755 ${config.services.nginx.user} ${config.services.nginx.user} - -"
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user