jonas.splinter
Blog

Why I now take nginx straight from nginx.org


Why I now take nginx straight from nginx.org - featured image

Security fixes for nginx reach nginx.org first and my operating system's package later. Why I switched to the official package, the trade-off, and the traps.

For years I installed nginx the way most people do: from my operating system's package, updated by the package manager along with everything else. In November 2026 I switched one of my servers to the official package repository from nginx.org, on the stable branch. The reason is simple: fixes arrive sooner. Below: why there is a delay, what I gave up, how to measure it yourself, the traps of switching, and how to make sure an update is really running.

Why the official package gets fixes sooner

When a security problem in nginx is fixed, nginx.org publishes a new release with the fix on the day of the advisory. The maintainers of an operating system work differently. They usually keep one version of nginx for the life of a release, take each fix, apply it to that older version, build it again and test it. That is careful work, and it takes time.

When I compared the two for my own server, the operating system's package carried the same fixes anywhere from a few days to several weeks later. Once, a fix was withdrawn and re-issued later.

nginx.org offers two branches. Mainline gets new features first. Stable only gets important fixes and security fixes. I chose stable: I want the fixes quickly, not the new features.

The trade-off is real. With the operating system's package, a second team reviews every fix before it reaches you. With the official package, you get what nginx.org ships, as soon as it ships. You lose that extra review and you gain speed. For the stable branch, where changes are small and focused, I consider that a reasonable trade. For server security it is a cheap win, but not a free one.

Check the delay for yourself

You do not have to take my word for it. nginx.org lists every advisory, with the vulnerable and the fixed versions, on its security advisories page (opens in a new tab). Each branch also has a CHANGES file with the date of every release; the nginx.org home page (opens in a new tab) links to both.

Then open the changelog of the nginx package from your own operating system. It lists, per package update, which fixes went in and when. Put the dates side by side: the day nginx.org published a fix, and the day your package carried it. That gap is your exposure window, for your system, not mine.

Start by finding out what you run now:

nginx -v    # the version of the installed binary
nginx -V    # version, build details and the modules it was built with

Keep the output of nginx -V. You will need it if you decide to switch.

Switching without surprises

The official packages and their install steps are linked from nginx.org's download page (opens in a new tab). The repository is signed with nginx's own keys. Before you trust a key, compare its fingerprint with the one listed on that page.

A dry run first

Before I changed anything, I unpacked the new package into a temporary folder, without installing it, and ran its nginx -t against my existing configuration. That shows whether your config works with the new build before your sites depend on it. Mine reported that the syntax was fine and then complained about a missing cache folder: the package creates that folder when it is installed, so the syntax line is the one that counts.

# run from the unpacked package, pointing at your existing main config file
./nginx -t -c /path/to/your/nginx.conf

I also compared the nginx -V output of the old and the new build, line by line. The configure arguments show which modules each build includes. Some optional modules from the old build were missing in the new one. My config used none of them, but check every module yours mentions. Two worth looking for explicitly are the real IP module and HTTP/2.

The traps I hit

  1. My own config files were overwritten. When the old package was replaced, the package manager installed the new package's default main config file and related files over mine, even though I had told it to keep my own. Those files no longer belonged to an installed package, so they no longer counted as mine. I restored them from the backup I had made minutes earlier.
  2. nginx did not start by itself. The new package's install step did not start nginx, so my sites were down for under a minute until I started it by hand.
  3. There is a demo site. The official package ships a demo server block that you probably do not want. Switch it off.
  4. Different defaults. The official package expects a different worker user, cache folder and log rotation setup than my operating system's package. Check that the user line in your config is still the one you want, and that log rotation still makes nginx reopen its logs.
  5. Features you rely on. Afterwards, check what your sites depend on: the real visitor IP if you run behind a proxy or CDN, access rules by IP address, and HTTP/2.

The lessons from those traps: back up the whole nginx config directory first, expect to restore the main config files before you start nginx, do the switch in a quiet moment while you watch it, and have the start command ready.

For log rotation, the rotation job sends nginx the USR1 signal, which tells it to reopen its log files. You can trigger the same thing yourself and check that new lines land in the fresh file. For access rules, test from an address that is not allowed and confirm it still gets a 403.

An installed update is not a running update

This is the part that is easy to miss. As I set it up, the official package installs a new version but does not restart nginx. Until nginx restarts, the old version keeps running in memory. So an update that "installed fine" is not live yet.

You can check this by hand. nginx -v reports the binary on disk. Compare the moment that binary was installed with the moment the running nginx master process started, which your system's process list shows. If the master process is older than the binary, you are still running the previous version.

nginx -v           # what is installed
nginx -t           # test the config before any restart
nginx -s reopen    # reopen log files (the same as the USR1 signal)

Note that nginx -s reload is not enough after an upgrade: it rereads the configuration and starts new worker processes from the same running master, so the old code stays in charge. A full restart, at a planned moment, is the simple way. nginx can also swap its binary on the fly (opens in a new tab), but that takes more care than most small setups need.

If you watch your updates with a tool, make sure a new nginx release counts as urgent there, and that "installed but not restarted" is something it can see. If you do not, a simple rule works too: after every nginx upgrade, plan a restart and check the result.

What I do not know yet

I do not know whether faster patches will make a practical difference for my sites. Most risk sits in application code, not in the web server, and a web server fix that arrives a few weeks earlier only matters if someone targets that gap.

I also do not know yet how often stable releases will need a restart, and therefore how much planned work this adds over a year. And I cannot promise the official package will never change its layout again.

What to do first

  1. Run nginx -V and save the output, so you know which modules your current build has.
  2. Compare the dates on nginx.org's advisories page with your own package's changelog.
  3. Decide whether the gap you find is worth losing the second review.
  4. If you switch: verify the key fingerprint, do a dry run with nginx -t, and back up your whole config directory.
  5. After the switch, restore your main config files, switch off the demo site, start nginx and test IP rules, log rotation and HTTP/2.
  6. From then on, restart nginx after every upgrade, or have something tell you when you have not.

Frequently asked questions

Should I pick the stable or the mainline branch?

For a server that just needs to keep running, stable. It only receives important fixes and security fixes. Mainline gets new features first, and with them more change to follow.

Is the official package less safe because fewer people review each fix?

It skips the review that your operating system's security team does on each fix. In return, the fix reaches you sooner. For the stable branch I think that is a reasonable trade, but it is a trade, and you should make it on purpose.

How do I know an nginx update is really running?

Compare when the installed binary changed with when the running master process started. If the process is older, the old version is still serving your sites. A planned restart after each upgrade solves it.

If you want to go further, read nginx.org's security advisories (opens in a new tab) and its guide to controlling nginx (opens in a new tab).

Related posts

More to read on the same topics