How to replace package install of nginx with compiled from source?

I installed nginx a while ago using the ubuntu PPA repository. Now I want to compile nginx from source so I can compile in and use the geo-ip module.

I know how to compile the new nginx from source.

How can I remove the nginx binary which was installed by the package? I want to leave all the configs and logs and upstart stuff etc untouched. I really just want to remove the old binary.

How can I do this?


Solution 1:

Unless you specify the --purge option (or use the purge command), the configuration files are left untouched while uninstallation. Therefore all you need to do is:

apt-get autoremove nginx

Or, if you installed a specific variant (such as -core, -full, -extra, etc.):

apt-get autoremove nginx-core