I upgraded from 14.04 server to 16.04 server. I have always used the official nginx packages, because I needed support for things like SPDY and HTTP2 which were not in the 14.04 version of nginx. Now when I try to update, I get the following error message.
Preparing to unpack .../nginx_1.11.1-1~xenial_amd64.deb ...
Unpacking nginx (1.11.1-1~xenial) over (1.10.0-0ubuntu0.16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.11.1-1~xenial_amd64.deb (--unpack):
trying to overwrite '/usr/share/nginx/html/index.html', which is also in package nginx-common 1.10.0-0ubuntu0.16.04.2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nginx_1.11.1-1~xenial_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed to perform requested operation on package. Trying to recover:
In my sources.list file I have:
deb http://nginx.org/packages/mainline/ubuntu/ xenial nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ xenial nginx
Any ideas how to resolve this issue?
Best Answer
This will likely fix it. I had this, and a couple of other problems myself.
Move to /etc and copy the nginx directory for safety:
Remove the old version of nginx:
Install the new nginx:
To enable and run nginx: