瀏覽網頁如果出現錯誤,會顯示一些提示資訊
提示過多的訊息,可能會被攻擊者所利用[@more@]隱藏 Nginx 版本資訊
加入 server_tokens off;
# vim /etc/nginx/nginx.conf
server {
listen 80;
server_name localhost;
server_tokens off;
重新啟動 Nginx Web Server
# /etc/init.d/nginx restart
也可以利用 curl 來取得相關資訊
設定前
# curl -IL 192.168.1.109
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Sun, 28 Sep 2014 13:30:44 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.4.4-14+deb7u14
設定後
# curl -IL 192.168.1.109
HTTP/1.1 200 OK
Server: nginx
Date: Sun, 28 Sep 2014 13:30:20 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.4.4-14+deb7u14
這一個部分 Apache Web Server 就可以完全隱藏,不會顯示 Web Sever 的名稱。