Nginx – esconder versión de servidor

Comprobar cabeceras de nuestro servidor:

# curl -I www.rubenortiz.es
HTTP/1.1 200 OK
Server: nginx/0.8.53
Date: Tue, 25 Jan 2011 11:21:20 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.3.3
Vary: Accept-Encoding

Puede ser interesante e incluso recomendable, ocultar la versión. Vamos a ver como. Añadimos lo siguiente a la configuración de nginx


# vim /etc/nginx/nginx.conf
http{
...
...
server_tokens off;
...
...
}

Comprobamos la validez de nuestro fichero de configuración

-bash-3.2# whereis nginx
nginx: /usr/sbin/nginx /etc/nginx /usr/share/nginx
/usr/share/man/man3/nginx.3pm.gz

-bash-3.2# /usr/sbin/nginx -t
the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful

Y finalmente, reiniciamos.

# service nginx restart

-bash-3.2# curl -I www.rubenortiz.es
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 25 Jan 2011 11:23:07 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.3.3
Vary: Accept-Encoding

Links
http://systemadmin.es/2009/09/esconder-la-version-de-nginx

1 thought on “Nginx – esconder versión de servidor

Leave a Reply

Your email address will not be published. Required fields are marked *