I'm trying to use port 80 on caddy but I'm getting an error saying the port is already in use. listen tcp :80: bind: address already in use.
When I check to see what is using it this is what I get.
sonar@SonarQube:~$ netstat -an | grep ":80"
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 10.1.1.5:42214 168.63.129.16:80 TIME_WAIT
tcp 0 0 10.1.1.5:42222 168.63.129.16:80 TIME_WAIT
tcp6 0 0 :::80 :::* LISTEN
How can I kill whatever is running on 80? Could running sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/caddy cause it?
If so how do I undo it ?
update (after adding -p)
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 10.1.1.5:42768 168.63.129.16:80 TIME_WAIT -
tcp 0 0 10.1.1.5:42760 168.63.129.16:80 TIME_WAIT -
tcp6 0 0 :::80 :::* LISTEN -
update 2
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1316/nginx -g daemo
tcp 0 0 10.1.1.5:39152 91.189.95.83:80 TIME_WAIT -
tcp 0 0 10.1.1.5:49340 168.63.129.16:80 TIME_WAIT -
tcp 0 0 10.1.1.5:46654 91.189.88.161:80 TIME_WAIT -
tcp 0 0 10.1.1.5:48740 91.189.88.162:80 TIME_WAIT -
tcp 0 0 10.1.1.5:49314 52.176.58.79:80 TIME_WAIT -
tcp 0 0 10.1.1.5:49284 168.63.129.16:80 TIME_WAIT -
tcp6 0 0 :::80 :::* LISTEN 1316/nginx -g daemo
You need to add the
-p
switch to netstat so that you get the same of the program too. You'll need to run it as root/sudo as well.You have nginx web server running on the server. Stop that with
service nginx stop
and you can start the other program.