【无标题】 如何在已经安装好的Nginx上增加新模块

news/2024/7/7 21:44:39 标签: nginx

前言

需要对NGINX 进行模块扩展,如果已经安装好了Nginx有不想重新安装覆盖的前提下如何新增模块呢?

下面通过安装nginx-http-flv-module作为示例进行说明,安装其他模块也是同样的道理。

下载第三方模块源码

https://github.com/winshining/nginx-http-flv-module.git

nginx_13">安装nginx

nginx_14">1. 下载nginx

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

2. 解压

 tar -zxvf nginx-1.12.1.tar.gz  

3. 编译

cd nginx-1.12.1  
./configure --prefix=/usr/local/nginx  --add-module=/nginx-http-flv-module    --with-http_ssl_module    
    make && make install  

如果你已经安装好nginx,那么需要单独安装第三方模块,不能重新安装

nginx_36">nginx第三方模块安装方法:

安装命令大致如下:

./configure --prefix=/你的安装目录  --add-module=/第三方模块目录

以安装nginx-http-flv-module模块为例,在已安装nginx情况下安装nginx-http-flv-module模块

因为以前nginx安装在/usr/local/nginx目录下,所以下面的操作都是以此目录为路径进行操作,如果安装到其他目录有些命令需要做对应的更改。

先查看原有nginx的配置参数并拷贝出来(重要)注意V 是大写的

/usr/local/nginx/sbin/nginx -V

接下来是重要的一步,将我们上面 原先安装的nginx配置参数 上,添加新的模块

configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --http-client-body-temp-path=/usr/local/nginx/tmp/client/ --http-proxy-temp-path=/usr/local/nginx/tmp/proxy/ --http-fastcgi-temp-path=/usr/local/nginx/tmp/fcgi/ --with-poll_module --with-file-aio --with-http_realip_module --with-http_addition_module --with-http_addition_module --with-http_random_index_module --with-http_stub_status_module --http-uwsgi-temp-path=/usr/local/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/nginx/scgi_temp --with-stream 

添加到后面

./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --http-client-body-temp-path=/usr/local/nginx/tmp/client/ --http-proxy-temp-path=/usr/local/nginx/tmp/proxy/ --http-fastcgi-temp-path=/usr/local/nginx/tmp/fcgi/ --with-poll_module --with-file-aio --with-http_realip_module --with-http_addition_module --with-http_addition_module --with-http_random_index_module --with-http_stub_status_module --http-uwsgi-temp-path=/usr/local/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/nginx/scgi_temp --with-stream --add-module=/usr/local/nginx/nginx-http-flv-module

注意,里面我 加了一个参数 --add-module=/nginx-http-flv-module 如果你有其他模块要一起安装,方法是一样的。

等待配置跑完。然后输入

make

进行编译。编译完成后,我们需要在根目录下我们刚下载的 /nginx-1.12.1/objs/ 目录下。找到刚刚编译好的 nginx 文件( 没有扩展名)

nginx 文件复制到 我们之前安装的 /usr/local/nginx/sbin/ 目录,替换旧的 nginx 文件。建议备份一下旧的 nginx 文件。

然后重启下nginx 就好了。

这个时候我们在查看下nginx 配置。

(base) [root@blog nginx]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.12.0
built by gcc 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
built with OpenSSL 1.1.1k  FIPS 25 Mar 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --http-client-body-temp-path=/usr/local/nginx/tmp/client/ --http-proxy-temp-path=/usr/local/nginx/tmp/proxy/ --http-fastcgi-temp-path=/usr/local/nginx/tmp/fcgi/ --with-poll_module --with-file-aio --with-http_realip_module --with-http_addition_module --with-http_addition_module --with-http_random_index_module --with-http_stub_status_module --http-uwsgi-temp-path=/usr/local/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/nginx/scgi_temp --with-stream --add-module=/usr/local/nginx/nginx-http-flv-module

配置完成


http://www.niftyadmin.cn/n/208707.html

相关文章

HTTP报错状态码及原因

一、400错误。 说明服务器无法理解用户的请求,除非进行修改,不然你按再多刷新也没有用。很有可能的情况是,你不小心输入错误了,导致服务器根本不知道你要表达什么。 认真检查有没有错误输入。 二、401错误 1.首先从你的站点的…

社科院与杜兰大学金融管理硕士项目—人生的每一条路都可以看作是正确的路

成年人的世界里没有什么是容易的。生活中经常听到人说:早知道现在过得这么辛苦,当年真应该好好读书;早知道这个行业这么难出头,当年真不应该踏入这一行;早知道爱人这么不靠谱,当年不跟他结婚就好了……有时…

身临其境数字世界:探索VR全景元宇宙展厅

随着科技的不断发展,虚拟现实技术已经成为我们生活中的一部分。VR全景元宇宙展厅作为其中的一种形式,正越来越受欢迎。在这里,您可以探索未知的世界,体验全新的视觉和感官体验。 一、VR全景元宇宙展厅的概述 VR全景元宇宙展厅是一…

ADRC线性跟踪微分器(ST+SCL语言)

ADRC自抗扰相关算法源代码和公式请参看下面文章链接: ADRC/Matlab一步步实现跟踪微分器TD(附完整PLC测试代码链接)_ladrc线性跟踪微分器差分方程_RXXW_Dor的博客-CSDN博客关于Adrc的理论分析不是本篇博客的重点,主要也是能力所限,相关理论大家可以看韩京清教授的论文,专栏…

模块打包器:Webpack、Rollup与Parcel的比较与实践

结论 根据项目需求和团队习惯选择合适的模块打包器是至关重要的。如果你需要高度可配置的解决方案,Webpack 是一个很好的选择。如果你关注输出结果的优化和 Tree Shaking,可以考虑使用 随着前端开发的复杂性不断提高,模块打包器已经成为现代前…

外卖小程序05

目录HttpClient作用发送http请求步骤测试使用HttpClient发送Http请求测试类微信小程序用户登录登录流程相关配置代码实现用户登录实体类UserLoginDTO返回数据实体类UserLoginVOController层Service层Mapper层拦截器JwtTokenUserInterceptor注册拦截器HttpClient 作用 发送http…

Scrapy API 启动爬虫

scarpy 不仅提供了 scrapy crawl spider 命令来启动爬虫,还提供了一种利用 API 编写脚本 来启动爬虫的方法。 scrapy 基于 twisted 异步网络库构建的,因此需要在 twisted 容器内运行它。 可以通过两个 API 运行爬虫:scrapy.crawler.Crawler…

UML与代码的对应关系

五种关系的耦合强弱比较&#xff1a;依赖<关联<聚合<组合<继承 依赖 虚线箭头 可描述为&#xff1a;Uses a 依赖是类的五种关系中耦合最小的一种关系。 因为在生成代码的时候&#xff0c;这两个关系类都不会增加属性。 注意1&#xff1a; Water类的生命期&…