咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
你需要直接通过编译Nginx源代码使模块数量最少化。通过限制只允许web服务器访问模块把风险降到最低。你可以只配置安装nginx你所需要的模块。例如,禁用SSL和autoindex模块你可以执行以下命令:
./configure –without-http_autoindex_module –without-http_ssi_module
make
make install
通过以下命令来查看当编译nginx服务器时哪个模块能开户或关闭:
./configure –help | less
禁用你用不到的nginx模块。
(可选项)更改nginx版本名称。
编辑文件/http/ngx_http_header_filter_module.c:
vi +48 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: Ninja Web Server” CRLF;
static char ngx_http_server_full_string[] = “Server: Ninja Web Server” CRLF;
保存并关闭文件。现在你可以编辑服务器了。增加以下代码到nginx.conf文件来关闭nginx版本号的显示。
server_tokens off