Question

Nginx stable or mainline for production server

Hello, i know its sound ok to go with stable version for production use. but for nginx its quite confusing even from their own documentation. this is what they say on a recent blog post

We generally recommend using the mainline branch. This is where we commit all new features, performance improvements, and enhancements. We actively test and QA the mainline branch, so it’s arguably more stable than the “stable” branch.

so i want to know which version u guy’s usually prefer when installing nginx for a production server? i must add, im not that expert in server management but i wouldn’t mind updating nginx regularly whenever the update is released.

one last thing, i know i can add stable version to apt-get repository by following command,

sudo add-apt-repository ppa:nginx/stable

but what would be the case for mainline version? and does ubuntu’s default repository updates almost as frequent as nginx releases a mainline branch?

thanks in advance.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

@newbie

If you just use apt-get install nginx without any ppa, then you will get whatever version that comes with your version of Ubuntu. It will be updated, but only for security releases.

If you use ppa:nginx/stable you’ll get the “stable” version. This is probably what you want. You’ll get security fixes, critical bugs and upgraded to new major versions.

If you use ppa:nginx/development you’ll get the “mainline” version. It usually means you’ll get a new version every couple of weeks. This is quite stable releases with very few bugs, but it’s not “stable” level.

Unless you specifically need some feature which has just been released in the “mainline” and you can’t wait for it to reach “stable”, then yes, use the “mainline” - otherwise stay with “stable”

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi, the “stable” branch means that the software will not get new feature updates, only major bug fixes (security/improvement updates, to fix/improve existing features), while the “mainline” branch means the software will get new features when updated. The branch is NOT beta, but might cause trouble on a production server (security issues may appear in the new features). In the documentation they claim “mainline” is better supported (and more tested) than stable (probably because stable has been mainline before).

This nginx blog post explains it: https://www.nginx.com/blog/nginx-1-6-1-7-released/

So, if your use of nginx is mission critical, then use stable branch, otherwise, just use the default version of the server from the ubuntu repos (don’t add any other repos stable/mainline).

Hope this helps!

@newbie

When it comes to NGINX, I prefer mainline – it’s actually what I use with my auto-installers. In terms of whether or not the NGINX mainline is suitable for production, it is, though IMO, if you’re planning on use mainline, you should be compiling it from source instead of using repositories.

When compiling it from source, you’re able to choose the version of OpenSSL or LibreSSL, PCRE, and ZLIB that you compile against – you’re able to include or not include certain core modules – and you are able to build in additional modules that are not in core.

The repositories provided for Ubuntu and even the PPA’s are built for general purpose and the out of box configuration is not exactly optimal for production – it needs tuning. Repositories and PPA’s may include every single module (many of which you may not need) or only a subset.

Repositories and PPA’s may be excellent for containers (Docker, LXC) where you’re normally not wanting spend the time it takes do a source compile (even though you only have to do it once every so often in most cases), though on a non-containerized deployment, I always use mainline and do a source compile.