{"id":1277,"date":"2014-12-16T18:12:48","date_gmt":"2014-12-16T10:12:48","guid":{"rendered":"https:\/\/cowmanchiang.me\/wp\/?p=1277"},"modified":"2023-10-31T15:44:26","modified_gmt":"2023-10-31T07:44:26","slug":"xibo-nginx-rtmp","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=1277","title":{"rendered":"Xibo &#038; Nginx-rtmp"},"content":{"rendered":"<p>20141226 \u66f4\u65b0<br \/>\n\u4e0d\u8981\u7528\u9019\u500b~~\u56e0\u70ba\u4e0d\u7a69\u5b9a~Orz<\/p>\n<hr \/>\n<p>\u74b0\u5883\uff1a Ubuntu 14.04.01<br \/>\n1. \u5b89\u88ddbuild deb\u9700\u8981\u7684\u5957\u4ef6<\/p>\n<pre lang=\"bash\">\napt-get install dpkg-dev\n<\/pre>\n<ol>\n<li>\u5275\u5efasource code\u76ee\u9304 <\/li>\n<\/ol>\n<pre lang=\"bash\">\nmkdir -p \/usr\/src\/nginx \ncd \/usr\/src\/nginx \n<\/pre>\n<ol>\n<li>\u900f\u904eapt-get\u4e0b\u8f09nginx\u7684source code<\/li>\n<\/ol>\n<pre lang=\"bash\">\napt-get source nginx\n<\/pre>\n<ol>\n<li>\u5b89\u88ddgit<\/li>\n<\/ol>\n<pre lang=\"bash\">\napt-get install git\n<\/pre>\n<ol>\n<li>\u900f\u904egit\u4e0b\u8f09nginx-rtmp-module\u7684source code<\/li>\n<\/ol>\n<pre lang=\"bash\">\ngit clone https:\/\/github.com\/arut\/nginx-rtmp-module.git\n<\/pre>\n<ol>\n<li>\u5c07rtmp\u3001xlst\u6a21\u7d44\u529f\u80fd\u52a0\u5165\u8a2d\u5b9a\u6a94\u4e2d<\/li>\n<\/ol>\n<pre lang=\"bash\">\ncd nginx-1.4.6\/\nvim debian\/rules\n<\u7565>\ncommon_configure_flags := \n                        --with-cc-opt=\"$(debian_cflags)\" \n                        --with-ld-opt=\"$(debian_ldflags)\" \n                        --prefix=\/usr\/share\/nginx \n                        --conf-path=\/etc\/nginx\/nginx.conf \n                        --http-log-path=\/var\/log\/nginx\/access.log \n                        --error-log-path=\/var\/log\/nginx\/error.log \n                        --lock-path=\/var\/lock\/nginx.lock \n                        --pid-path=\/run\/nginx.pid \n                        --http-client-body-temp-path=\/var\/lib\/nginx\/body \n                        --http-fastcgi-temp-path=\/var\/lib\/nginx\/fastcgi \n                        --http-proxy-temp-path=\/var\/lib\/nginx\/proxy \n                        --http-scgi-temp-path=\/var\/lib\/nginx\/scgi \n                        --http-uwsgi-temp-path=\/var\/lib\/nginx\/uwsgi \n                        --with-debug \n                        --with-pcre-jit \n                        --with-ipv6 \n                        --with-http_ssl_module \n                        --with-http_stub_status_module \n                        --with-http_realip_module \n                        --with-http_xslt_module \n                        --add-module=\/usr\/src\/nginx\/nginx-rtmp-module \n<\u7565>\n<\/pre>\n<ol>\n<li>\u5b89\u88ddnginx\u7684\u76f8\u4f9d\u6027\u5957\u4ef6<\/li>\n<\/ol>\n<pre lang=\"bash\">\napt-get build-dep nginx\n<\/pre>\n<ol>\n<li>\u5efa\u7f6enginx deb<\/li>\n<\/ol>\n<pre lang=\"bash\">\ndpkg-buildpackage -b\n<\/pre>\n<ol>\n<li>\u5b89\u88dd\u7de8\u8b6f\u5f8c\u7684\u6a94\u6848<\/li>\n<\/ol>\n<pre lang=\"bash\">\ndpkg --install nginx-common_1.4.6-1ubuntu3.1_all.deb nginx-full_1.4.6-1ubuntu3.1_amd64.deb\n<\/pre>\n<ol>\n<li>\u5b89\u88ddphp5-fpm\u3001mysql-server\u3001php5-mysql<\/li>\n<\/ol>\n<pre lang=\"bash\">\napt-get install php5-fpm php5-mysql mysql-server\n<\/pre>\n<ol>\n<li>\u4fee\u6539nginx default site\u8a2d\u5b9a\uff0c\u52a0\u5165php\u529f\u80fd\u53ca\u76f8\u95dchost<\/li>\n<\/ol>\n<pre lang=\"bash\">\nvim \/etc\/nginx\/sites-available\/default\nserver {\n        listen 80 default_server;\n        listen [::]:80 default_server ipv6only=on;\n\n        root \/usr\/share\/nginx\/html;\n        index index.html index.htm index.php;\n\n        # Make site accessible from http:\/\/localhost\/\n        server_name xibo;\n\n        location \/ {\n                # First attempt to serve request as file, then\n                # as directory, then fall back to displaying a 404.\n                try_files $uri $uri\/ =404;\n                # Uncomment to enable naxsi on this location\n                # include \/etc\/nginx\/naxsi.rules\n        }\n\n        # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests\n        #location \/RequestDenied {\n        #       proxy_pass http:\/\/127.0.0.1:8080;\n        #}\n\n        error_page 404 \/404.html;\n\n        # redirect server error pages to the static page \/50x.html\n        #\n        error_page 500 502 503 504 \/50x.html;\n        location = \/50x.html {\n                root \/usr\/share\/nginx\/html;\n        }\n\n        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n        #\n        location ~ .php$ {\n                fastcgi_split_path_info ^(.+.php)(\/.+)$;\n        #       # NOTE: You should have \"cgi.fix_pathinfo = 0;\" in php.ini\n        #\n        #       # With php5-cgi alone:\n        #       fastcgi_pass 127.0.0.1:9000;\n        #       # With php5-fpm:\n                fastcgi_pass unix:\/var\/run\/php5-fpm.sock;\n                fastcgi_index index.php;\n                include fastcgi_params;\n        }\n\n\n        location \/obs-remote {\n            root  html;\n            index index.html index.htm;\n            #allow\n            #deny all;\n            #auth_basic \"Restricted Area\";\n            #auth_basic_user_file    \/usr\/local\/nginx\/conf\/.htpasswd;\n        }\n\n        location \/stat {\n            rtmp_stat all;\n\n            # Use this stylesheet to view XML as web page\n            # in browser\n            rtmp_stat_stylesheet stat.xsl;\n            #auth_basic \"Restricted Area stat\";\n            #auth_basic_user_file    \/usr\/local\/nginx\/conf\/.htpasswd;\n        }\n\n        location \/stat.xsl {\n            # XML stylesheet to view RTMP stats.\n            # Copy stat.xsl wherever you want\n            # and put the full directory path here\n            root html;\n            # auth_basic \"Restricted Area stat.xsl\";\n            # auth_basic_user_file    \/usr\/local\/nginx\/conf\/.htpasswd;\n        }\n\n\n        # deny access to .htaccess files, if Apache's document root\n        # concurs with nginx's one\n        #\n        #location ~ \/.ht {\n        #       deny all;\n        #}\n}\n<\/pre>\n<ol>\n<li>\u4fee\u6539nginx\u8a2d\u5b9a\uff0c\u52a0\u5165rtmp\u6a21\u7d44<\/li>\n<\/ol>\n<pre lang=\"bash\">\nvim \/etc\/nginx\/nginx.conf\nrtmp {\n        server {\n                listen 1935;\n                chunk_size 4096;\n\n                application live {\n                        live on;\n                        record off;\n                        #allow publish 10.0.0.0\/8;\n                        #deny publish all;\n                        #allow play 10.201.80.107;\n                        #deny play all;\n                }\n        }\n}\n<\/pre>\n<ol>\n<li>\u91cd\u65b0\u555f\u52d5<\/li>\n<\/ol>\n<pre lang=\"bash\">\nservice nginx restart\n<\/pre>\n<ol>\n<li>\u4e0b\u8f09xibo cms<\/li>\n<\/ol>\n<pre lang=\"bash\">\ncd \/usr\/share\/nginx\/html\nwget https:\/\/launchpad.net\/xibo\/1.6\/1.6.4\/+download\/xibo-server-164.tar.gz\ntar zxvf xibo-server-164.tar.gz\nmv xibo-server-164 xibo\n<\/pre>\n<ol>\n<li>\u8a2d\u5b9a\u5b58\u53d6\u6b0a\u9650<\/li>\n<\/ol>\n<pre lang=\"bash\">\nchown -R www-data:www-data .\n<\/pre>\n<ol>\n<li>\u5b89\u88ddphp gd\u6a21\u7d44<\/li>\n<\/ol>\n<pre lang=\"bash\">\napt-get install php5-gd\n<\/pre>\n<ol>\n<li>\u5b89\u88ddphp mcrypt\u6a21\u7d44\u4e26\u555f\u52d5<\/li>\n<\/ol>\n<pre lang=\"bash\">\napt-get install php5-mcrypt\nphp5enmod mcrypt\n<\/pre>\n<ol>\n<li>\u6839\u64da\u7db2\u9801\u986f\u793a\u7684\u5efa\u8b70\uff0c\u8abf\u6574php.ini<br \/>\nYou probably want to allow larger files to be uploaded than is currently available with your PHP configuration.<br \/>\nWe suggest setting your PHP post_max_size and upload_max_size to at least 128M, and also increasing your max_execution_time to at least 120 seconds.<\/li>\n<\/ol>\n<pre lang=\"bash\">\nvim \/etc\/php5\/fpm\/php.ini\n<\u7565>\nmax_execution_time = 120\n<\u7565>\npost_max_size = 1024M\n<\u7565>\nupload_max_filesize = 1024M\n<\u7565>\n<\/pre>\n<ol>\n<li>\u91cd\u65b0\u555f\u52d5nginx\u3001php<\/li>\n<\/ol>\n<pre lang=\"bash\">\nservice php5-fpm restart\nservice nginx restart\n\n20. \u958b\u555f\u7db2\u9801\u8a2d\u5b9axibo\n\u9023\u7d50\uff1ahttp:\/\/{\u4f3a\u670d\u5668IP}\/xibo\n<\/pre>\n<ol>\n<li>\u8a2d\u5b9a\u6642\u6703\u8a62\u554f\u4e00\u500b\u5b58\u653e\u6a94\u6848\u7684\u76ee\u9304\uff0c\u4fee\u6539\u6b0a\u9650\u4f9bnginx\u5b58\u53d6<\/li>\n<\/ol>\n<pre lang=\"bash\">\nmkdir \/home\/xibo\nchown -R www-data:www-data \/home\/xibo\/\n<\/pre>\n<ol>\n<li>\u5b89\u88dd\u5b8c\u5f8c\u767b\u5165\u6e2c\u8a66<br \/>\n\u9810\u8a2d\u5e33\u865f xibo_admin<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>20141226 \u66f4\u65b0 \u4e0d\u8981\u7528\u9019\u500b~~\u56e0\u70ba\u4e0d\u7a69\u5b9a~Orz \u74b0\u5883\uff1a Ubuntu 14.04.01 1. \u5b89\u88ddbuild deb\u9700\u8981\u7684\u5957\u4ef6 apt-get install dpkg-dev \u5275\u5efasource code\u76ee\u9304 mkdir -p \/usr\/src\/nginx cd \/usr\/src\/nginx \u900f\u904eapt-get\u4e0b\u8f09nginx\u7684source code apt-get source nginx \u5b89\u88ddgit apt-get install git \u900f\u904egit\u4e0b\u8f09nginx-rtmp-module\u7684source code git clone https:\/\/github.com\/arut\/nginx-rtmp-module.git \u5c07rtmp\u3001xlst\u6a21\u7d44\u529f\u80fd\u52a0\u5165\u8a2d\u5b9a\u6a94\u4e2d cd nginx-1.4.6\/ vim debian\/rules common_configure_flags := &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=1277\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,82,90],"tags":[],"class_list":["post-1277","post","type-post","status-publish","format-standard","hentry","category-nginx","category-ubuntu","category-xibo"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1277"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1277\/revisions"}],"predecessor-version":[{"id":1967,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1277\/revisions\/1967"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}