What happens to installed NGINX version if I compile another version from source ?

I have create a LEMP stack and NGINX 1.4.6 is installed. I was wondering what will happen if I compile a different version of NGINX (1.10 for example) and add my modules of choice.

Will it 1.10 overwrite version 1.4.6 and is this just like ‘updating’ the previous version ? Or is it a necessary to first remove the previous version and then compile the newer version ? Basically I’m asking this because I also wan to know what happens to the virtual hosts which I might have configured … (and ofcourse config file)

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.

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.


When compiling from source, as in, downloading the source code from NGINX and running actual build commands from the CLI, you’re able to specify the exact location of where NGINX stores files as well as what directories NGINX will use for said storage. As long as you specify different locations, the previous versions’ files and directories should remain unmodified.

You could technically run ten versions of NGINX as long as you specify different locations and names. Each of which could even have it’s own init or systemd script (though you’d most likely need to modify the ones that come along with the compile or create your own).

When doing a non-standard build, you may also need to create the directories first, otherwise the build may error out since you’re telling NGINX to use directories that do not yet exist.

If you’re worrying about your filesystem, you should back up your system prior to making the configuration change.

That being said, I’m pretty sure that by default Nginx installs its files to a different location than stock packages (prefix /usr/local/)