Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx startup fail on mac osx 10.9 mavericks

I've been using nginx for a few months without issue, but after upgrading to Mac OS X 10.9 Mavericks, when trying to start nginx I get this:

nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] still could not bind() 

I tried to follow these directions, but I'm not having much luck as my outputs seem a little different.

The output of:

ps ax -o pid,ppid,%cpu,vsz,wchan,command|egrep '(nginx|PID)' 

is:

  PID  PPID  %CPU      VSZ WCHAN  COMMAND  15015 12765  0.0  2432784 -      egrep (nginx|PID) 

I've tried killing the process using that PID, but it never seems to die... Any ideas on how to get nginx running again? Any help is greatly appreciated!!

like image 739
gjunkie Avatar asked Nov 01 '13 03:11

gjunkie


2 Answers

Your ps ... | egrep command is finding itself, not an instance of nginx (look at the "COMMAND" column). Since port 80 is in use, it's likely some other program (maybe the Apache that comes with the OS?) is running and grabbing it. To find out, run:

sudo lsof -i:80 

If it's the system Apache ("httpd") program, you can probably shut it down with:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 

If that doesn't do it, more info will be needed to figure out what's grabbing port 80 and how it's getting started.

like image 171
Gordon Davisson Avatar answered Sep 23 '22 14:09

Gordon Davisson


Probably still nginx runnig and listening on port 80. try this command

sudo killall nginx 
like image 42
pashaplus Avatar answered Sep 26 '22 14:09

pashaplus