5

My Debian Sid installation has init listening :::80 and is prevent nginx from starting.

root@server01:~# systemctl status nginx.service
* nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2015-11-07 11:06:01 GMT; 16s ago
  Process: 9506 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 9501 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Nov 07 11:05:59 server01 nginx[9506]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 07 11:05:59 server01 nginx[9506]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 07 11:06:00 server01 nginx[9506]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 07 11:06:00 server01 nginx[9506]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 07 11:06:01 server01 nginx[9506]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 07 11:06:01 server01 nginx[9506]: nginx: [emerg] still could not bind()
Nov 07 11:06:01 server01 systemd[1]: nginx.service: Control process exited, code=exited status=1
Nov 07 11:06:01 server01 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Nov 07 11:06:01 server01 systemd[1]: nginx.service: Unit entered failed state.
Nov 07 11:06:01 server01 systemd[1]: nginx.service: Failed with result 'exit-code'.

netstat output

root@server01:~#netstat -tulpn
tcp        0      0 0.0.0.0:44443           0.0.0.0:*               LISTEN      2878/pulseaudio
tcp        0      0 0.0.0.0:4713            0.0.0.0:*               LISTEN      2878/pulseaudio
tcp        0      0 0.0.0.0:31021           0.0.0.0:*               LISTEN      10395/x2goclient
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1170/rpcbind
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1015/sshd
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      16155/cupsd
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN      939/inetd
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      1212/postgres
tcp        0      0 0.0.0.0:31001           0.0.0.0:*               LISTEN      14223/x2goclient
tcp6       0      0 :::36157                :::*                    LISTEN      2878/pulseaudio
tcp6       0      0 :::4713                 :::*                    LISTEN      2878/pulseaudio
tcp6       0      0 :::111                  :::*                    LISTEN      1170/rpcbind
tcp6       0      0 :::80                   :::*                    LISTEN      1/init
tcp6       0      0 :::22                   :::*                    LISTEN      1015/sshd
tcp6       0      0 ::1:631                 :::*                    LISTEN      16155/cupsd
tcp6       0      0 ::1:5432                :::*                    LISTEN      1212/postgres

systemctl -all list-sockets

LISTEN                          UNIT                            ACTIVATES
/dev/rfkill                     systemd-rfkill.socket           systemd-rfkill.service
/run/acpid.socket               acpid.socket                    acpid.service
/run/dmeventd-client            dm-event.socket                 dm-event.service
/run/dmeventd-server            dm-event.socket                 dm-event.service
/run/lvm/lvmetad.socket         lvm2-lvmetad.socket             lvm2-lvmetad.service
/run/lvm/lvmpolld.socket        lvm2-lvmpolld.socket            lvm2-lvmpolld.service
/run/systemd/fsck.progress      systemd-fsckd.socket            systemd-fsckd.service
/run/systemd/initctl/fifo       systemd-initctl.socket          systemd-initctl.service
/run/systemd/journal/dev-log    systemd-journald-dev-log.socket systemd-journald.service
/run/systemd/journal/socket     systemd-journald.socket         systemd-journald.service
/run/systemd/journal/stdout     systemd-journald.socket         systemd-journald.service
/run/systemd/journal/syslog     syslog.socket                   rsyslog.service
/run/udev/control               systemd-udevd-control.socket    systemd-udevd.service
/var/run/acpi_fakekey           acpi-fakekey.socket             acpi-fakekey.service
/var/run/avahi-daemon/socket    avahi-daemon.socket             avahi-daemon.service
/var/run/cups/cups.sock         cups.socket                     cups.service
/var/run/dbus/system_bus_socket dbus.socket                     dbus.service
[::]:80                         pywwetha.socket                 pywwetha.service
audit 1                         systemd-journald-audit.socket   systemd-journald.service
kobject-uevent 1                systemd-udevd-kernel.socket     systemd-udevd.service

^[[0;1;39m20 sockets listed.

curl command

root@server01:~#
root@server01:~# curl localhost
curl: (56) Recv failure: Connection reset by peer
root@server01:~# curl 0.0.0.0:80
curl: (7) Failed to connect to 0.0.0.0 port 80: Connection refused
root@server01:~# curl 127.0.0.1:80
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
root@server01:~# curl :::80
curl: (7) Failed to connect to :: port 80: Connection refused
root@server01:~#
3
  • What do you get if you run curl 0.0.0.0:80? – p8952 Nov 7 '15 at 11:57
  • What do you get from systemctl list-sockets? – Jeff Schaller Nov 7 '15 at 12:19
  • p8952 and JeffSchaller - Question has been updated with command output – vfclists Nov 7 '15 at 16:48
4

Based on your additional output, it appears that pywwetha is listening on port 80.

Stop it with:

systemctl stop pywwetha.service

and then disable it with:

systemctl disable pywwetha.service

and then try starting nginx after that.

3
  • 1
    Is there some reason why the netstat command did not list pywwetha and listed it as init? – vfclists Nov 8 '15 at 0:00
  • That's the way systemd works (I'm not intimately familiar with systemd yet) -- it must treat these services as parts of its own init process instead of as separate processes – Jeff Schaller Nov 8 '15 at 0:40
  • 4
    systemd works a bit like inetd for these things: it listens on the network ports and starts the appropriate daemon when an incoming connection is made. I guess the idea is that the port is immediately available to be connected to as soon as systemd has started.Another systemd design decision I don't really agree with (but maybe I'm just an old fart who can't get used to these newfangled things). – wurtel Nov 9 '15 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.