"Sub-process /usr/bin/dpkg returned an error code (1)" trying to install nginx

I'm trying to install nginx, but I'm getting the following error message:

kurt@kurt-ThinkPad:~$ sudo apt-get install nginx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libjs-inherits libjs-node-uuid libuv1 libuv1-dev linux-headers-4.4.0-47
  linux-headers-4.4.0-47-generic linux-image-4.4.0-47-generic
  linux-image-extra-4.4.0-47-generic node-abbrev node-ansi
  node-ansi-color-table node-archy node-async node-block-stream
  node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent
  node-form-data node-fstream node-fstream-ignore node-github-url-from-git
  node-glob node-graceful-fs node-gyp node-inherits node-ini
  node-json-stringify-safe node-lockfile node-lru-cache node-mime
  node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt
  node-normalize-package-data node-npmlog node-once node-osenv node-qs
  node-read node-read-package-json node-request node-retry node-rimraf
  node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent
  node-underscore node-which
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  nginx-common nginx-core
Suggested packages:
  fcgiwrap nginx-doc
The following NEW packages will be installed:
  nginx nginx-common nginx-core
0 upgraded, 3 newly installed, 0 to remove and 9 not upgraded.
Need to get 458 kB of archives.
After this operation, 1482 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://nl.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-common all 1.10.0-0ubuntu0.16.04.4 [26,6 kB]
Get:2 http://nl.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-core amd64 1.10.0-0ubuntu0.16.04.4 [428 kB]
Get:3 http://nl.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx all 1.10.0-0ubuntu0.16.04.4 [3498 B]
Fetched 458 kB in 0s (685 kB/s)
Preconfiguring packages ...
Selecting previously unselected package nginx-common.
(Reading database ... 501856 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.10.0-0ubuntu0.16.04.4_all.deb ...
Unpacking nginx-common (1.10.0-0ubuntu0.16.04.4) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../nginx-core_1.10.0-0ubuntu0.16.04.4_amd64.deb ...
Unpacking nginx-core (1.10.0-0ubuntu0.16.04.4) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.10.0-0ubuntu0.16.04.4_all.deb ...
Unpacking nginx (1.10.0-0ubuntu0.16.04.4) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for systemd (229-4ubuntu12) ...
Setting up nginx-common (1.10.0-0ubuntu0.16.04.4) ...
Setting up nginx-core (1.10.0-0ubuntu0.16.04.4) ...
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nginx, action "start" failed.
dpkg: error processing package nginx-core (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-core (>= 1.10.0-0ubuntu0.16.04.4) | nginx-full (>= 1.10.0-0ubuntu0.16.04.4) | nginx-light (>= 1.10.0-0ubuntu0.16.04.4) | nginx-extras (>= 1.10.0-0ubuntu0.16.04.4); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.
 nginx depends on nginx-core (<< 1.10.0-0ubuntu0.16.04.4.1~) | nginx-full (<< 1.10.0-0ubuntu0.16.04.4.1~) | nginx-light (<< 1.10.0-0ubuntu0.16.04.4.1~) | nginx-extras (<< 1.10.0-0ubuntu0.16.04.4.1~); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
 dependency problems - leaving No apport report written because the error message indicates its a followup error from a previous failure.
                                                         unconfigured
Processing triggers for systemd (229-4ubuntu12) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
 nginx-core
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

Here is a relevant-seeming excerpt from /var/log/syslog:

Dec  6 12:04:47 kurt-ThinkPad systemd[1]: Started CUPS Scheduler.
Dec  6 12:04:47 kurt-ThinkPad systemd[1]: Started ACPI event daemon.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: Reloading.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: snapd.refresh.timer: Adding 5h 37min 39.335667s random time.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: Started CUPS Scheduler.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: Started ACPI event daemon.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: Reloading.
Dec  6 12:04:49 kurt-ThinkPad systemd[1]: snapd.refresh.timer: Adding 3h 39min 30.123677s random time.
Dec  6 12:04:49 kurt-ThinkPad systemd[1]: Started CUPS Scheduler.
Dec  6 12:04:49 kurt-ThinkPad systemd[1]: Started ACPI event daemon.
Dec  6 12:04:49 kurt-ThinkPad systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec  6 12:04:49 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:49 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:49 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:49 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:50 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:50 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:50 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:50 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:51 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:51 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:51 kurt-ThinkPad nginx[6334]: nginx: [emerg] still could not bind()
Dec  6 12:04:51 kurt-ThinkPad systemd[1]: nginx.service: Control process exited, code=exited status=1
Dec  6 12:04:51 kurt-ThinkPad systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Dec  6 12:04:51 kurt-ThinkPad systemd[1]: nginx.service: Unit entered failed state.
Dec  6 12:04:51 kurt-ThinkPad systemd[1]: nginx.service: Failed with result 'exit-code'.

Any ideas why the installation is not working? (The answer to a similar problem, E: Sub-process /usr/bin/dpkg returned an error code (1) [related to google chrome], suggests that some files are corrupted).

Update

Here is also the error message generated by Ubuntu to be sent to its development community:

enter image description here


See the line

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

It means that there already is a web server running (listening on port 80 which is needed by nginx). Try this command to identify which process is using the port 80:

netstat -tlnp | fgrep -w :80

Uninstall that server, or reconfigure it so that it uses another port than 80.