常常搭建nginxserver,可是好像每次的情况都不同,这次具体记录这个过程:

平台:unbutu 10.04 内核:2.6.32-33-generic

1, 编译环境搭建。

sudo apt-get install g++

sudo apt-get -y install autoconf automake build-essential libass-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libssl-dev

2, 建立例如以下下载脚本:getfile.sh

-------------------getfile.sh start here---------------------------------------------------

wget http://sourceforge.net/projects/pcre/files/pcre/8.32/pcre-8.32.tar.gz

wget http://www.openssl.org/source/openssl-1.0.1f.tar.gz

wget http://nginx.org/download/nginx-1.5.9.tar.gz

wget http://zlib.net/zlib-1.2.8.tar.gz

wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz

git clone https://github.com/arut/nginx-rtmp-module.git

tar xvf pcre-8.32.tar.gz

tar xvf openssl-1.0.1e.tar.gz

tar xvf nginx-1.5.9.tar.gz

tar xvf zlib-1.2.8.tar.gz

tar xvf nginx_mod_h264_streaming-2.2.7.tar.gz

-------------------getfile.sh end here---------------------------------------------------



3, 编译openssl,这部是必须的,否则后面编译会fail的

cd openssl-1.0.1e #:notice the version

编译静态库



sudo chmod u+x ./config

./config --prefix=/usr/local --openssldir=/usr/local/opensll

make

sudo make install



编译动态库



./config shared --prefix=/usr/local --openssldir=/usr/local/opensll

make clean

make

sudo make install







4, 在nginx-1.5.9建立配置文件脚本nginx_configure.sh

----------------------------nginx_configure.sh start here-------------------------------------------------

#!/bin/sh



./configure \

--prefix=/usr/local/nginx/ \

--add-module=../nginx-rtmp-module \

--with-http_ssl_module \

--add-module=../nginx_mod_h264_streaming-2.2.7 \

--with-pcre=../pcre-8.32 \

--with-zlib=../zlib-1.2.8  \

--with-http_flv_module \

--with-http_stub_status_module \

--with-http_mp4_module  \

--with-cc-opt='-O3'

----------------------------nginx_configure.sh end here-------------------------------------------------



5, 进入nginx-1.5.9

运行./nginx_configure.sh

make -j8

出错

-------------------------------the error log start here----------------------------------------------------

In file included from ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_h264_streaming_module.c:2:

../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c: In function ‘ngx_streaming_handler’:

../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c:158: error: ‘ngx_http_request_t’ has no member named ‘zero_in_uri’

make[1]: *** [objs/addon/src/ngx_http_h264_streaming_module.o] Error 1

make[1]: *** Waiting for unfinished jobs....

make[1]: Leaving directory `/media/zangcf/works/works/nginx/x86/nginx_x86/nginx-1.5.9'

make: *** [build] Error 2

-------------------------------the error log end here-------------------------------------------------------

gedit ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c



找到例如以下

  /* TODO: Win32 */

  if (r->zero_in_uri)

  {

    return NGX_DECLINED;

  }

凝视掉



make -j8



pass



sudo make install



6, 改动config文件

sudo cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak

sudo gedit /usr/local/nginx/conf/nginx.conf

--------------------------nginx.conf start here----------------------------------------------------------------------

user  root;

worker_processes  2;



#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;



#pid        logs/nginx.pid;





events {

    worker_connections  1024;

}





http {

    include       mime.types;

    default_type  application/octet-stream;



    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

    #                  '$status $body_bytes_sent "$http_referer" '

    #                  '"$http_user_agent" "$http_x_forwarded_for"';



    #access_log  logs/access.log  main;



    sendfile        on;

    #tcp_nopush     on;



    #keepalive_timeout  0;

    keepalive_timeout  65;



    #gzip  on;



    server {

        listen      80 default;

        server_name  localhost;

        autoindex            on;

        autoindex_exact_size on;

        root    /var/wwwroot;

        index   index.html index.htm index.php;



        #charset koi8-r;



        #access_log  logs/host.access.log  main;



        #error_page  404              /404.html;



        # redirect server error pages to the static page /50x.html

        #

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }



        # proxy the PHP scripts to Apache listening on 127.0.0.1:80

        #

        #location ~ \.php$ {

        #    proxy_pass   http://127.0.0.1;

        #}



        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

        #

        location ~* \.php$ {

            fastcgi_index  index.php;

            client_max_body_size 64m;

            fastcgi_pass   unix:/data/data/android.php-fpm/tmp/php-fpm.socket;

            fastcgi_param  SCRIPT_FILENAME  /data/data/android.wwwroot$fastcgi_script_name;

            include        fastcgi_params;

        }



       location ~ \.flv$ {

                         flv;

                        }

       location ~ \.mp4$ {

                         mp4;

                        }





        # deny access to .htaccess files, if Apache's document root

        # concurs with nginx's one

        #

        #location ~ /\.ht {

        #    deny  all;

        #}

    }





    # another virtual host using mix of IP-, name-, and port-based configuration

    #

    #server {

    #    listen       8000  default;

    #    listen       somename:8080;

    #    server_name  somename  alias  another.alias;



    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}





    # HTTPS server

    #

    #server {

    #    listen     443 default;

    #    server_name  localhost;



    #    ssl                  on;

    #    ssl_certificate      cert.pem;

    #    ssl_certificate_key  cert.key;



    #    ssl_session_timeout  5m;



    #    ssl_protocols  SSLv2 SSLv3 TLSv1;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;

    #    ssl_prefer_server_ciphers   on;



    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}



}





rtmp {

    server {

        listen 1935;



        chunk_size 4096;



        application myapp {

            live on;

        }

    }

}



----------------------------------------------nginx.conf end here--------------------------------------



7, 測试

Ubuntu x86 64 settup nginx rtmp server的更多相关文章

  1. (转)Nginx+rtmp+ffmpeg搭建流媒体服务器

    (1)下载第三方扩展模块nginx-rtmp-module # mkdir module && cd module //创建一个存放模块的目录 # wget https://githu ...

  2. Ubuntu中使用Nginx+rtmp模块搭建流媒体视频点播服务

    1. 背景 不知不觉笔者来到流媒体部门已经一年半多了,积攒了不少的流媒体知识,但平时工作也比较忙,很少进行总结性的梳理,最近准备花几个周末时间写一个流媒体系列的实践文章,也算是给自己做总结的同时帮助有 ...

  3. Ubuntu中使用Nginx+rtmp搭建流媒体直播服务

    一.背景 本篇文章是继上一篇文章<Ubuntu中使用Nginx+rtmp模块搭建流媒体视频点播服务>文章而写,在上一篇文章中我们搭建了一个点播服务器,在此基础上我们再搭建一个直播服务器, ...

  4. 转:Nginx RTMP 功能研究

    看点: 1.    Nginx 配置信息与使用.  (支持 rtmp与HLS配置) 2.    有ffmpeg 编译与使用,    命令行方式来测试验证客户端使用. 转自:http://blog.cs ...

  5. Ubuntu18.04下配置Nginx+RTMP服务器,实现点播/直播/录制功能

    2019.3.22更新 最新的nginx-1.15.9可与openssl1.1.1兼容了 以下原文: 这个东西我眼馋挺久了,最近终于试玩了一下,感觉很好玩,在搭建的过程在也遇到一些坑,这里总结一下 安 ...

  6. 使用 ffmpeg nginx rtmp 搭建实时流处理平台

    环境: ubuntu 16.04 问题引入: 使用 opencv 获取摄像头数据帧, 进行处理之后(如进行 keypoint 识别), 将 opencv 中图像的 Mat类型转化为 ffmpeg 的 ...

  7. ffmpeg,rtmpdump和nginx rtmp实现录屏,直播和录制

    公司最近在做视频直播的项目,我这里分配到对直播的视频进行录制,录制的方式是通过rtmpdump对rtmp的视频流进行录制 前置的知识 ffmpeg: 用于实现把录屏工具发出的视频和音频流,转换成我们需 ...

  8. Mac上搭建Nginx + rtmp

    介绍 nginx是非常优秀的开源服务器,用它来做hls或者rtmp流媒体服务器是非常不错的选择,本人在网上整理了安装流程,分享给大家并且作备忘. 安装步骤 1.先安装brew: /usr/bin/ru ...

  9. Mac上搭建直播服务器Nginx+rtmp

    简介 nginx是非常优秀的开源服务器,用它来做hls或者rtmp流媒体服务器是非常不错的选择,本人在网上整理了安装流程,分享给大家并且作备忘. 步骤安装 1.安装Homebrow Homebrew简 ...

随机推荐

  1. docker-machine 快速搭建docker环境

    环境:腾讯云测试成功 1.条件:本地主机A和远程主机B 2.远程主机B,配置免密登录 1,在本地主机A上生成公钥和私钥,生成命令:ssh-keygen -t rsa 私钥:id_rsa 公钥:id_r ...

  2. Linux基础学习-Samba文件共享服务

    使用Samba文件共享服务 Samba起源: 早期网络想要在不同主机之间共享文件大多要用FTP协议来传输,但FTP协议仅能做到传输文件却不能直接修改对方主机的资料数据,这样确实不太方便,于是便出现了N ...

  3. Python能干啥?

    Python之py9 Python之py9-录音自动下载 Python之py9-py9作业检查 Python之py9-py9博客情况获取 Python之py9-微信监控获取mp3_url Python ...

  4. POJ 2976 Dropping test(01分数规划模板)

    01分数划分详情可阅读:http://www.cnblogs.com/perseawe/archive/2012/05/03/01fsgh.html 题意: 给出n个a和b,让选出n-k个使得最大 二 ...

  5. php 复制文件夹

    public function recurse_copy($src,$des) { $dir = opendir($src); @mkdir($des); while(false !== ( $fil ...

  6. 【05】Firebug动态执行JavaScript

    Firebug动态执行JavaScript 您可以使用Firebug来编写并实时执行一个JavaScript. 这是为了测试,并确保该脚本工作正常,这是将JavaScript代码部署在生产环境前的好方 ...

  7. PTA 02-线性结构4 Pop Sequence (25分)

    题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/665 5-3 Pop Sequence   (25分) Given a stack wh ...

  8. 洛谷P2414 - [NOI2011]阿狸的打字机

    Portal Description 首先给出一个只包含小写字母和'B'.'P'的操作序列\(s_0(|s_0|\leq10^5)\).初始时我们有一个空串\(t\),依次按\(s_0\)的每一位进行 ...

  9. HDU 3527 SPY

    http://poj.org/problem?id=3615 基础题 狂STL #include <bits/stdc++.h> using namespace std; set<s ...

  10. [NOIP1999] 提高组 洛谷P1016 旅行家的预算

    题目描述 一个旅行家想驾驶汽车以最少的费用从一个城市到另一个城市(假设出发时油箱是空的).给定两个城市之间的距离D1.汽车油箱的容量C(以升为单位).每升汽油能行驶的距离D2.出发点每升汽油价格P和沿 ...