欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 资讯 > openresty-nginx添加新模块

openresty-nginx添加新模块

2025/5/15 22:52:47 来源:https://blog.csdn.net/qq_43566782/article/details/146510815  浏览:    关键词:openresty-nginx添加新模块

背景:产品提了一个需求 下载站外视频在本地磁盘 需要通过nginx提供外部访问(就是说在浏览器能够浏览这个视频文件)安装的 openresty 没有 with-http_mp4_module 模块 需要支持

原先安装流程

wget https://openresty.org/download/openresty-1.11.2.5.tar.gz
tar zxvf openresty-1.11.2.5.tar.gz
cd openresty-1.11.2.5
./configure --prefix=/usr/local/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module
gmake
gmake install

添加新模块流程

# 重新加上 with-http_mp4_module
./configure --prefix=/usr/local/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module --with-http_mp4_module
# 编译 最终生成的 可执行文件在 openresty-1.11.2.5/build/nginx-1.11.2/objs/nginx
gmake

不要再执行 gmake install 因为会覆盖安装,
找到当前的nginx执行位置/usr/local/openresty/nginx/sbin/nginx
备份一下 cp nginx nginx.bak
停掉当前的nginx服务
systemctl stop nginx.service
不停止会报错
cp: cannot create regular file ‘/usr/local/openresty/nginx/sbin/nginx’: Text file busy
将刚才编译加上的新模块复制到此为止
sudo cp /data/apps/openresty-1.11.2.5/build/nginx-1.11.2/objs/nginx /usr/local/openresty/nginx/sbin/
重启服务
systemctl restart nginx.service
查看当前nginx的模块信息
./nginx -V

可以看到加上了with-http_mp4_module 模块

configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../iconv-nginx-module-0.14 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.10 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-http_mp4_module --with-http_ssl_module```

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词