Nginx Intro - Build and Install With self-defined module

本文介绍如何通过shell脚本配置Nginx并添加多个第三方模块,包括h264_streaming、rtmp模块等,以实现视频流等功能。同时展示了如何添加自定义模块到Nginx编译配置中。

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


#!/bin/sh



cd nginx-1.11.6


./configure --prefix=/opt/nginx \
   --add-module=../nginx_mod_h264_streaming-master \
   --add-module=../nginx-rtmp-module-master \
   --with-http_flv_module --with-http_mp4_module \
   --with-http_stub_status_module --with-http_sub_module \
   --with-pcre=../pcre-8.39 --with-zlib=../zlib-1.2.8  \
   --with-http_ssl_module --with-openssl=/usr/local \
   --with-http_realip_module --with-debug --user=www --group=www


#make clean
#make -j4 || exit 1

#sudo make install



############################################################

1. nginx-config.sh


#!/bin/sh


cd nginx-1.11.6


./configure --prefix=/opt/nginx \
   --add-module=../nginx_mod_h264_streaming-master \
   --add-module=../nginx-rtmp-module-master \
   --add-module=../nginx-my-module \
   --with-http_flv_module --with-http_mp4_module \
   --with-http_stub_status_module --with-http_sub_module \
   --with-pcre=../pcre-8.39 --with-zlib=../zlib-1.2.8  \
   --with-http_ssl_module --with-openssl=/usr/local \
   --with-http_realip_module --with-debug --user=www --group=www


#make clean
#make -j4 || exit 1
#sudo make install


2. config file in nginx_my_module directory

ngx_addon_name=ngx_http_helloworld_module
HTTP_MODULES="$HTTP_MODULES ngx_http_helloworld_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_helloworld_module.c"


3. ngx_http_helloworld_module.c file in nginx_my_module directory

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值