{"id":210,"date":"2018-05-17T00:17:45","date_gmt":"2018-05-16T16:17:45","guid":{"rendered":"https:\/\/blog.bilicloud.com\/?p=210"},"modified":"2022-03-03T10:57:04","modified_gmt":"2022-03-03T01:57:04","slug":"%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85%e5%b8%a6%e6%9c%89rtmp%e6%a8%a1%e5%9d%97%e7%9a%84nginx","status":"publish","type":"post","link":"https:\/\/blog.foxsar.black\/?p=210","title":{"rendered":"\u7f16\u8bd1\u5b89\u88c5\u5e26\u6709RTMP\u6a21\u5757\u7684nginx"},"content":{"rendered":"<p>#20200522 Update: \u5c06\u6a21\u5757\u66f4\u6362\u4e3a\u66f4\u65b0\u4e14\u4ecd\u5728\u7ef4\u62a4\u7684nginx-http-flv-module\uff0c\u4f7f\u7528\u65b9\u6cd5\u548c\u6548\u679c\u4e00\u6837\uff0c\u4f46\u529f\u80fd\u66f4\u5f3a\u5927<\/p>\n<p>RT\uff0c\u8fd9\u4e2a\u53c2\u7167\u4e86obs\u7684\u8bba\u575b\u4e0a\u7684\u5e16\u5b50\uff0c\u7136\u540e\u628a\u5176\u4e2d\u53ef\u80fd\u9047\u5230\u7684\u5751\u4e5f\u603b\u7ed3\u4e86\u8fdb\u6765\uff0c\u4ece0\u5f00\u59cb\u7f16\u8bd1\uff0c\u7cfb\u7edf\u4e3aDebian 11\uff0croot\u8d26\u6237<\/p>\n<p>1\u3001\u641e\u4e00\u4e0b\u7f16\u8bd1\u73af\u5883<\/p>\n<pre>apt-get install git build-essential openssl libpcre3 libpcre3-dev unzip libssl-dev zlib1g-dev<\/pre>\n<p>\u7f16\u8bd1\u5e76\u5b89\u88c5nginx<\/p>\n<pre>git clone <a href=\"https:\/\/github.com\/nginx\/nginx\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/nginx\/nginx<\/a> #nginx\ngit clone <a href=\"https:\/\/github.com\/winshining\/nginx-http-flv-module\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/winshining\/nginx-http-flv-module<\/a> #nginx-rtmp\u6a21\u5757\ncd nginx\n.\/auto\/configure --prefix=\/usr\/local\/nginx --with-http_ssl_module --add-module=..\/nginx-http-flv-module --with-http_v2_module --with-stream --with-http_realip_module\nmake\nmake install<\/pre>\n<p>\uff08\u4f60\u95ee\u6211\u4e3a\u5565\u8981\u7f16\u8bd1http2\uff1f\u4e07\u4e00\u4ee5\u540e\u4f60\u8981\u7528\u548b\u529e\uff0c\u4ee5\u540e\u8981\u7528\u7684\u65f6\u5019\u7701\u4e8b\u554a\uff09<br \/>\n\u5199\u914d\u7f6e\u6587\u4ef6\uff0c\u8fd9\u4e00\u884c\u76f4\u63a5\u5728nginx.conf\u7684\u6700\u540e\u4e00\u4e2a\u5927\u62ec\u53f7\u4e4b\u5916\u8d34\u4e0a\u5373\u53ef\uff0c\u5177\u4f53\u529f\u80fd\u53ef\u6309\u7167git\u4e0a\u7684\u8bf4\u660e\u6765\u8fdb\u884c\u8c03\u6574<\/p>\n<pre>vim \/usr\/local\/nginx\/conf\/nginx.conf\n\nrtmp {\n    server {\n        listen 1935;\n        chunk_size 4096;\n        application live {\n            live on;\n            record off;\n        }\n    }\n}<\/pre>\n<p>\u5b9e\u9645\u4f7f\u7528\u65b9\u6cd5\uff1a<br \/>\n\u6309\u7167\u4e0a\u9762\u7684\u53c2\u6570\uff0cURL\u9ed8\u8ba4\u683c\u5f0f\u662frtmp:\/\/yourdomain\/live\/***<br \/>\n\u661f\u53f7\u5185\u662f\u81ea\u5b9a\u4e49\u5185\u5bb9\uff0c\u53ef\u4ee5\u7406\u89e3\u4e3a\u90e8\u5206\u5e94\u7528\u4e0a\u6240\u8bf4\u7684\u5bc6\u7801<br \/>\n\u53e6\u5916\uff0c\u90e8\u5206\u63a8\u6d41\u8f6f\u4ef6\u4e0d\u5141\u8bb8\u5bc6\u7801\u7a7a\u7740\uff08\u4f8b\u5982obs\uff0c\u7a7a\u7740\u4f1a\u63a8\u4e0d\u4e0a\u53bb\u6d41\uff09\uff0c\u8fd9\u65f6\u5019\u5c31\u5e94\u8be5\u628a\u5730\u5740\u62c6\u6210\u4e24\u4efd\u586b\u5199<\/p>\n<pre>\u6d41\u5a92\u4f53\u5730\u5740\uff1artmp:\/\/yourdomain\/live\n\u5bc6\u7801\uff1a***<\/pre>\n<p>\u6ce8\u610f\uff1a\u6d41\u5a92\u4f53\u5730\u5740\u7684\u6700\u540e\u7ed3\u5c3e\u4e0d\u8981\u52a0\u659c\u6760\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u5e2e\u4f60\u52a0<br \/>\n\u6700\u540e\uff0c\u52a0\u4e00\u4e2anginx\u81ea\u542f\u52a8\u5427<\/p>\n<pre>vim \/lib\/systemd\/system\/nginx.service\n\n[Unit]\nDescription=The NGINX HTTP and reverse proxy server\nAfter=syslog.target network.target remote-fs.target nss-lookup.target\n\n[Service]\nType=forking\nPIDFile=\/var\/run\/nginx.pid\nExecStartPre=\/usr\/local\/nginx\/sbin\/nginx -t -c \/usr\/local\/nginx\/conf\/nginx.conf\nExecStart=\/usr\/local\/nginx\/sbin\/nginx -c \/usr\/local\/nginx\/conf\/nginx.conf\nExecReload=\/usr\/local\/nginx\/sbin\/nginx -s reload\nExecStop=\/bin\/kill -s QUIT $MAINPID\nPrivateTmp=true\n\n[Install]\nWantedBy=multi-user.target\n\n\u4fdd\u5b58\u9000\u51fa\uff0c\u7136\u540e\n\nsystemctl enable nginx.service #\u5f00\u542f\u81ea\u542f\u52a8\nsystemctl start nginx.servier #\u542f\u52a8\u670d\u52a1\n<\/pre>\n<p>\u53c2\u8003\u94fe\u63a5\uff1a<br \/>\n<a href=\"https:\/\/obsproject.com\/forum\/resources\/how-to-set-up-your-own-private-rtmp-server-using-nginx.50\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to set up your own private RTMP server using nginx<\/a><br \/>\n<a href=\"https:\/\/docs.nginx.com\/nginx\/admin-guide\/installing-nginx\/installing-nginx-open-source\/\" target=\"_blank\" rel=\"noopener noreferrer\">Installing NGINX Open Source<\/a><br \/>\n<a href=\"https:\/\/github.com\/arut\/nginx-rtmp-module\/\" target=\"_blank\" rel=\"noopener noreferrer\">nginx-rtmp-module<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>#20200522 Update: \u5c06\u6a21\u5757\u66f4\u6362\u4e3a\u66f4\u65b0\u4e14\u4ecd\u5728\u7ef4\u62a4\u7684nginx-http-flv-module\uff0c\u4f7f &hellip; <a href=\"https:\/\/blog.foxsar.black\/?p=210\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u7f16\u8bd1\u5b89\u88c5\u5e26\u6709RTMP\u6a21\u5757\u7684nginx<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[33,40],"class_list":["post-210","post","type-post","status-publish","format-standard","hentry","category-2","tag-nginx","tag-rtmp"],"_links":{"self":[{"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/posts\/210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=210"}],"version-history":[{"count":9,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/posts\/210\/revisions"}],"predecessor-version":[{"id":338,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=\/wp\/v2\/posts\/210\/revisions\/338"}],"wp:attachment":[{"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.foxsar.black\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}