🎯 Mission Briefing: Port 80 Is Taken
Since this morning the company website shows "Apache2 Debian Default Page — It works!" instead of the shop. Nobody touched nginx's configuration. Yesterday, though, a colleague installed something for a small PHP script…
Your objective
Find out why nginx isn't serving the site, find which program is holding the web port, and give the port back to nginx — for good.
Investigation toolkit
curl -s http://localhost | grep -i title # What does the server answer?
systemctl status nginx # Is nginx running? Why not?
sudo ss -tlnp # Which program listens on which port?
sudo lsof -i :80 # The same question, asked of one port
tail /var/log/apt/history.log # What was installed yesterday?
Fix and verify
sudo systemctl stop apache2 # Free port 80
sudo systemctl disable apache2 # …and keep it free after a reboot
sudo systemctl start nginx
curl -I http://localhost # Server: nginx?
💡 Only one program can listen on a port.
Address already in usemeans someone else got there first —ss -tlnptells you who. Withoutsudoyou see the port but not the program.