ubuntu12.04 虚拟机 编译安装nginx 1.3.6 搭建支持flv mp4 流媒体服务器

本文详细介绍了如何编译安装nginx并配置其支持flv和mp4流媒体播放,包括安装依赖库、下载源码、配置选项、解决编译错误等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

nginx 是个很优秀的http服务器,ucweb就在用这个。

nginx可以支持flv mp4的流媒体播放。


考虑编译安装下nginx 。

参考 http://blog.youkuaiyun.com/sunvince/article/details/6426967

===================

1. 安装过程为 

(1)编译安装pcre。 make       make install 即可。 记得加入 --with-pcre-jit    否则会报错。

(2)编译安装yamdi-1.8 (Yet Another Metadata Injector for FLV),make make install 即可。

(3)下载源码 

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


(4) 配置nginx,

其中,264_mod  、 zlib 、 niginx_acesskey 、openssl 、pcre 源码 使用绝对路径。


配置选项为:

./configure --add-module=/home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7 --with-pcre=/home/zhangbin/mserver/nginx/pcre-8.31 --with-pcre-jit --with-zlib=/home/zhangbin/mserver/nginx/zlib/1.2.3 --prefix=/usr/local/nginx --with-http_flv_module --with-http_stub_status_module --with-http_mp4_module --add-module=/home/zhangbin/mserver/nginx/nginx-accesskey-2.0.3 --with-http_ssl_module --with-openssl=/home/zhangbin/mserver/nginx/openssl-1.0.1c --with-cc-opt='-O3


会给

CFLAGS中加入-O3 :

CC = gcc
CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g -O3 -D_LARGEFILE_SOURCE -DBUILDING_NGINX
CPP = gcc -E
LINK = $(CC)


 (5) 编译

      1 )编译遇到了Werror的问题,参考nginx 1.3.6 编译报错 [-Werror=unused-but-set-variable]的解决  http://blog.youkuaiyun.com/commshare/article/details/8051060解决。

     2 )  需要指明源码路径:

--with-http_ssl_module --with-openssl=/home/zhangbin/mserver/nginx/openssl-1.0.1c

否则报错:

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.


(6)附录:
我的configure输出结果:
root@ubuntu:/home/zhangbin/mserver/nginx/nginx-1.3.6# ./configure  --add-module=/home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7  --with-pcre=/home/zhangbin/mserver/nginx/pcre-8.31 --with-zlib=/home/zhangbin/mserver/nginx/zlib/1.2.3  --prefix=/usr/local/nginx --with-http_flv_module --with-http_stub_status_module --with-http_mp4_module  --add-module=/home/zhangbin/mserver/nginx/nginx-accesskey-2.0.3 --with-http_ssl_module --with-openssl=/home/zhangbin/mserver/nginx/openssl-1.0.1c --with-cc-opt='-O3'
checking for OS
 + Linux 3.2.0-31-generic-pae i686
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for sched_setaffinity() ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for nobody group ... not found
checking for nogroup group ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for SO_SETFIB ... not found
checking for SO_ACCEPTFILTER ... not found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT ... found
checking for TCP_INFO ... found
checking for accept4() ... found
checking for int size ... 4 bytes
checking for long size ... 4 bytes
checking for long long size ... 8 bytes
checking for void * size ... 4 bytes
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 4 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 4 bytes
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for openat(), fstatat() ... found
configuring additional modules
adding module in /home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7
 + ngx_http_h264_streaming_module was configured
adding module in /home/zhangbin/mserver/nginx/nginx-accesskey-2.0.3
 + ngx_http_accesskey_module was configured
creating objs/Makefile

Configuration summary
  + using PCRE library: /home/zhangbin/mserver/nginx/pcre-8.31
  + using OpenSSL library: /home/zhangbin/mserver/nginx/openssl-1.0.1c
  + md5: using OpenSSL library
  + sha1: using OpenSSL library
  + using zlib library: /home/zhangbin/mserver/nginx/zlib/1.2.3

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

root@ubuntu:/home/zhangbin/mserver/nginx/nginx-1.3.6# 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

等风来不如迎风去

你的鼓励是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值