修改nginx伺服器類型

來源:互聯網
上載者:User

通常nginx伺服器不隱藏伺服器類型及版本資訊 curl -I http://10.60.30.23  擷取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: pws 1.0 ” CRLF;  49 static char ngx_http_server_full_string[] = “Server: pws 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://10.60.30.23  被修改後的伺服器資訊代碼  HTTP/1.1 200 OK  Server: pws 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      作者 275553385

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.