openresty解决allow头和server头信息泄露的方案

编程

解压缩openresty.zip这个压缩包

可以看到若干rpm包

这些包的下载地址

https://copr-be.cloud.fedoraproject.org/results/openresty/openresty/epel-7-x86_64/

 

2:

全部上传到linux服务器(centos 7.6)

3:

输入命令安装:

cd /root/openresty/

rpm -ivh openresty*.rpm

 

4:

安装成功后使用以下命令测试是否安装成功

openresty -t

 

5:

编辑以下文件

/usr/local/openresty/nginx/conf/nginx.conf

6:

http{ 下增加一行

server_tokens off; 隐藏版本号

 

7:

36行的server中的location中修改并增加

        location / {

                   proxy_pass http://127.0.0.1:81/;

                  more_clear_headers "Server";   #清除sever头

                  more_clear_headers "Allow";#清除Allow

        }

其中我将tomcat的运行端口改成了81,所以反向代理到了本机的81端口

直接走tomcat的时候

走openresty的时候

关闭openresty的命令

pkill openresty

 

启动openresty命令

openresty

 

以上是 openresty解决allow头和server头信息泄露的方案 的全部内容, 来源链接: utcz.com/z/515069.html

回到顶部