Basic nginx headers

Internet

For a few months now, Clara’s and my VPS has been running nginx. Our sites are by no means high traffic, but we’ve benefited greatly from nginx’s reduced memory requirements compared to Apache. Some of the configuration still confuses me, and I doubt I’ll be as competent at it as I am with Apache for a while, but I’m learning.

To state your character set in your HTTP headers, use this in your relevant http, server or location section of your nginx.conf:

charset  UTF-8;

And to stop advertising your nginx version:

server_token  off;

And if broad IE compatibility is still important, you can save yourself some invalid HTML5 meta attributes by adding this header:

add_header  X-UA-Compatible 'IE=Edge';

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person in bios. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.