lnmp隐藏服务器信息

1.隐藏 X-Powered-By

vim /usr/local/php/etc/php-fpm.d/www.conf

添加:php_flag[expose_php] = off

2.修改响应头Server的信息

需要重新编译nginx

vim src/http/ngx_http_header_filter_module.c

将内容:

static char ngx_http_server_string[] = "Server: nginx" CRLF;

static char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;

更改为:

static char ngx_http_server_string[] = "Server: MyServer" CRLF;

static char ngx_http_server_full_string[] = "Server:MyServer" CRLF;

执行命令

make && make install

最后重新启动nginx

 

posted @ 2021-07-01 15:29  程序员小艺  阅读(93)  评论(0)    收藏  举报