3

I'm building a docker project where I assign port 80 to nginx.

ports:
  - 80:80

This fails when I docker-compose up -d because it says that port 80 is already taken.

After restarting my mac indeed this mysterious thing is up and running but I have no idea what is it. Docker itself is off. Vagrant is off.

The following command sudo lsof -i -P | grep -i "80" doesn't help much.

How can I find out which app is taking port 80?

PS. When I map different port:

ports:
  - 81:80

Then http://localhost:81 shows my stuff with no issues whatsoever.

Matt Komarnicki
  • 5,198
  • 7
  • 40
  • 92

1 Answers1

11

OK, I've found information that Big Sur is shipped with Apache preinstalled.

macOS 11.0 Big Sur comes with Apache 2.4 pre-installed.

Stop it with: sudo apachectl stop

Prevent auto start with: sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

EDIT:

I've added -w - this will prevent the job from being loaded after macOS restarts.

Matt Komarnicki
  • 5,198
  • 7
  • 40
  • 92
  • 3
    wow. This issue wasted so much of my time after I upgraded to Big Sur. Thank you! – fersarr Jan 21 '21 at 16:12
  • 2
    Hum I cannot stop apache on my computer. When I do : 'sudo apachectl stop' I got the message : ''' /System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service Unload failed: 113: Could not find specified service ''' – Miguel Bocquier Aug 06 '21 at 00:43