【问题标题】:Nginx add modules = how to?Nginx添加模块=如何?
【发布时间】:2020-07-07 08:23:36
【问题描述】:

我只是在 Oracle linux 上安装 Nginx 并将其用作反向代理。

一切如我所愿。

现在我想添加这个模块:

ngx_http_v2_module

我该怎么做? 配置文件在哪里?

我看到的每个地方他们都说

他的模块不是默认构建的,应该通过 --with-http_v2_module 配置参数启用。

但我没有看到任何如何做到这一点的例子......

当我进入时

/usr/share/nginx/moudles/

我只看到这些文件:

-rw-r--r--. 1 root root 65 Mar 30  2018 mod-http-geoip.conf
-rw-r--r--. 1 root root 72 Mar 30  2018 mod-http-image-filter.conf
-rw-r--r--. 1 root root 64 Mar 30  2018 mod-http-perl.conf
-rw-r--r--. 1 root root 71 Mar 30  2018 mod-http-xslt-filter.conf
-rw-r--r--. 1 root root 59 Mar 30  2018 mod-mail.conf
-rw-r--r--. 1 root root 61 Mar 30  2018 mod-stream.conf

所以我需要下载一些东西吗?放到这个目录下?

还有 使用此模块,我可以将图像推送给用户吗? 意思是他会去网站,会在他的网页上看到我的图片\图标? 还是我需要另一个模块?

谢谢,

【问题讨论】:

  • 当我运行命令时,我看到了 (--with-http_v2_module) ,现在怎么办?
  • 好的,怎么办?

标签: nginx oraclelinux


【解决方案1】:

假设这是关于 Oracle Linux 7,Oracle 在两个渠道中提供 nginx:

  • 适用于 Oracle Linux 7 (ol7_developer_EPEL) 的 EPEL 包
 # yum info nginx
Loaded plugins: langpacks, ulninfo
Installed Packages
Name        : nginx
Arch        : x86_64
Epoch       : 1
Version     : 1.12.2
Release     : 2.el7
Size        : 1.5 M
Repo        : installed
From repo   : ol7_developer_EPEL
Summary     : A high performance web server and reverse proxy server
URL         : http://nginx.org/
License     : BSD
Description : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
            : IMAP protocols, with a strong focus on high concurrency, performance and low
            : memory usage.

它是用http2模块编译的:

# /usr/sbin/nginx -V 2>&1 | sed -e 's/--with/\n\0/g' | grep http_v2
--with-http_v2_module 
  • 或者,软件集合库中也有一个版本 (ol7_software_collections)
# yum info rh-nginx114
Loaded plugins: langpacks, ulninfo
Installed Packages
Name        : rh-nginx114
Arch        : x86_64
Version     : 1.14
Release     : 6.el7
Size        : 0.0  
Repo        : installed
From repo   : ol7_software_collections
Summary     : Package that installs rh-nginx114
License     : GPLv2+
Description : This is the main package for rh-nginx114 Software Collection.

我们还支持 http2:

# /opt/rh/rh-nginx114/root/usr/sbin/nginx -V 2>&1 | sed -e 's/--with/\n\0/g' | grep http_v2
--with-http_v2_module 

所以基本上无论你安装了什么版本,你都应该被覆盖。

关于这个模块的配置,你应该看看upstream NGINX documentation

【讨论】:

  • 我检查了一下,我和你一样在第一个帖子中发布:用于 Oracle Linux 7 的 EPEL 包。但我需要做什么才能使其工作,在配置文件中进行哪些更改?
  • 还想知道 - 我需要做什么才能在用户从我的代理输入的每个网页中添加一个简单的 jpg bunner - 这个模块可以做到这一点吗?还是我需要别的东西?
  • http_v2_module 支持 HTTP2 协议,并且它的 Server Push 功能与您想要实现的目标无关(恐怕没有简单的解决方案)。
  • ohhhh,我以为我可以做到这一点。好吧,至少现在我知道这不可能——而且我不会在这上面浪费时间。谢谢!
猜你喜欢
  • 2021-09-16
  • 1970-01-01
  • 2015-05-30
  • 2018-05-02
  • 2015-02-15
  • 1970-01-01
  • 2020-09-04
  • 2011-03-31
  • 1970-01-01
相关资源
最近更新 更多