nginx 获取header 请求参数_Nginx设置Header头信息

本文介绍了如何使用ngx_headers_more模块在Nginx中删除出站Header信息,如X-Powered-By和WP-Super-Cache。首先,从GitHub下载模块,然后检查Nginx编译参数,确保正确配置并重新编译Nginx。在Nginx配置文件中添加`more_clear_headers`指令以移除不需要的Header,最后验证配置并重启Nginx。
摘要由CSDN通过智能技术生成

Nginx 使用 ngx_headers_more 模块来增加、删除出站、入站的 Header 信息。

ngx_headers_more 项目主页

默认该模块没有加入到 Nginx 的源码中,要想使用相关功能需要在编译 Nginx 时加入该模块。

本人服务器中的 Nginx 在编译时没有加入该模块,使用 -V 查看当前 Nginx 的编译参数:

[root@z-dig ~]# nginx -V

nginx version: www.z-dig.com

built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)

built with OpenSSL 1.0.1e-fips 11 Feb 2013

TLS SNI support enabled

configure arguments: --prefix=/usr/local/nginx --user=www --group=www \

--with-http_ssl_module --with-http_stub_status_module

[root@z-dig ~]#

1

2

3

4

5

6

7

8

[root@z-dig~]# nginx -V

nginxversion:www.z-dig.com

builtbygcc4.4.720120313(RedHat4.4.7-16)(GCC)

builtwithOpenSSL1.0.1e-fips11Feb2013

TLSSNIsupportenabled

configurearguments:--prefix=/usr/local/nginx--user=www--group=www\

--with-http_ssl_module--with-http_stub_status_module

[root@z-dig~]#

从官网下载模块:

[root@z-dig ~]# cd /usr/local/src/

[root@z-dig src]# wget 、https://codeload.github.com/openresty/headers-more-nginx-module/zip/master\

-O ./headers-more-nginx-module-master.zip

[root@z-dig src]# unzip headers-more-nginx-module-master.zip

1

2

3

4

[root@z-dig~]# cd /usr/local/src/

[root@z-digsrc]# wget 、https://codeload.github.com/openresty/headers-more-nginx-module/zip/master\

-O./headers-more-nginx-module-master.zip

[root@z-digsrc]# unzip he

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值