修改nginx服务器类型
生活随笔
收集整理的這篇文章主要介紹了
修改nginx服务器类型
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
通常nginx服務器不隱藏服務器類型及版本信息? curl -I http://www.aaa.com? 獲取web服務器的類型和版本代碼 ? HTTP/1.1 200 OK ? Server: nginx nginx/0.8.53 ? Date: Tue, 14 Dec 2010 08:10:06 GMT ? Content-Type: text/html?? Content-Length: 151 ? Last-Modified: Mon, 13 Dec 2010 09:39:55 GMT ? Connection: keep-alive ? Accept-Ranges: bytes ?? 這對于服務器安全來說是個隱患,用以下方法可以改善這種情況? 1. 編輯源代碼../src/http/ngx_http_header_filter_module.c? 修改前代碼 ? 48 static char ngx_http_server_string[] = “Server: nginx” CRLF; ? 49 static char ngx_http_server_full_string[] = “Server: ” NGINX_VER CRLF; ?? 改為? 修改后代碼 ? 48 static char ngx_http_server_string[] = “Server: test 1.0 ” CRLF; ? 49 static char ngx_http_server_full_string[] = “Server: test?1.0 ” NGINX_VER CRLF; ? 然后編譯安裝。? 2. 編輯/usr/local/nginx/conf/nginx.conf,添加? server_tokens off;? 重新啟動nginx? /usr/local/nginx/sbin/nginx -s reload? 最終結果如下? curl -I http://www.aaa.com? 被修改后的服務器信息代碼 ? HTTP/1.1 200 OK ? Server: test?1.0 ? Date: Tue, 14 Dec 2010 08:24:32 GMT ? Content-Type: text/html ? Content-Length: 151 ? Last-Modified: Mon, 13 Dec 2010 09:39:55 GMT ? Connection: keep-alive ? Accept-Ranges: bytes ??
轉載于:https://www.cnblogs.com/lhj588/p/4301234.html
總結
以上是生活随笔為你收集整理的修改nginx服务器类型的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 求一个关于依赖的个性签名!
- 下一篇: 搜神记的作者是谁啊?