Instantly share code, notes, and snippets.

Embed
What would you like to do?
# file: nginx.conf
# date: 2018-10-13
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
rtmp {
server{
listen 1935;
chunk_size 10240;
application live {
live on;
record off;
on_publish http://127.0.0.1:2080/auth;
push rtmp://live.twitch.tv/app/xxxxxxxxxx;
push rtmp://a.rtmp.youtube.com/xxxxxxxxxx;
}
}
}
http {
server {
listen 127.0.0.1:2080;
location /auth {
rewrite_by_lua '
ngx.req.read_body()
local name = ngx.req.get_post_args().name
if (name == "xxxxxxxxxx") then
ngx.status = 200
ngx.say("OK")
ngx.exit(200)
else
ngx.status = 403
ngx.say("Forbidden")
ngx.exit(403)
end
';
}
}
}
@nanpuyue

This comment has been minimized.

Owner

nanpuyue commented Oct 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment