Nginx缺省banner修改

下载 nginx-1.19.1.tar.gz
操作步骤:

[root@Test ~]# tar -xzvf nginx-1.19.1.tar.gz 

修改ngx_http_header_filter_module.c 文件

[root@Test ~]# vim nginx-1.19.1/src/http/ngx_http_header_filter_module.c 

需要修改:

static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;

修改成:

static u_char ngx_http_server_string[] = "Server: unknow" CRLF;
static u_char ngx_http_server_full_string[] = "Server: unknow"  CRLF;
static u_char ngx_http_server_build_string[] = "Server: unknow"  CRLF;

重新编译:

 ./configure --prefix=/usr/local/nginx && make && make install 

编译报错信息:

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

解决方法:

[root@Test ~]#  yum -y install openssl openssl-devel

注:非root用户要启动1024下的端口

setcap cap_sys_admin,cap_net_bind_service,cap_sys_resource+ep /usr/local/nginx/sbin/nginx 

重启 nginx

[root@Test ~]# systemctl restart nginx 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值