Created
October 13, 2018 05:36
-
-
Save nanpuyue/43691d3252caf81c458df94377e87621 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://blog.nanpuyue.com/2018/047.html