This is how my custom server header looks like (Server:R2D2) –
curl -I www.slashgeek.net HTTP/1.1 200 OK Content-Type: text/html Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT Expires: Sun, 12 May 2013 02:55:30 GMT Pragma: public Cache-Control: max-age=3600, public, must-revalidate, proxy-revalidate Etag: c39b09b955e4bb5b69b56bce7e36ce7e X-Powered-By: W3 Total Cache/0.9.2.9 Vary: Accept-Encoding Server: R2D2 Date: Sun, 12 May 2013 02:06:43 GMT X-Varnish: 1472756484 1472756321 Age: 673 Via: 1.1 varnish Connection: keep-alive
To use custom server header with nginx you will have to recompile nginx from source using
headers-more-nginx-module module. It might not always be the ideal solution, specially if you enjoy the seamless update feature of package managers or your server configs are not located on default paths. There is another painless way to change your server header using varnish. Varnish is often used as reverse proxy in front of nginx, for a fast and responsive site during high traffic.
Unlike changing server header with nginx, it is very trivial to do this with varnish. Edit varnish config located (Ubuntu) at
/etc/varnish/default.vcl and edit these two lines to look like below, make sure to use your own custom server name by changing “R2D2”.
unset beresp.http.Server; set beresp.http.Server = "R2D2";