Mac os nginx startup launchd configure

I want nginx to be started up every time my Mac os 10.5 system boots up.
So I create a launchd file:

<?xml version="1.0" encoding="UTF-8"?> Disabled Label com.zhan.nginx OnDemand ProgramArguments /opt/local/sbin/nginx RunAtLoad It works, but inside nginx error log, I see: 2008/08/01 08:24:50 [emerg] 244#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:24:50 [emerg] 244#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:24:50 [emerg] 244#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:24:50 [emerg] 244#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:24:50 [emerg] 244#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:24:50 [emerg] 244#0: still could not bind() 2008/08/01 08:25:01 [emerg] 257#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:25:01 [emerg] 257#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:25:01 [emerg] 257#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:25:01 [emerg] 257#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:25:01 [emerg] 257#0: bind() to 0.0.0.0:80 failed (48: Address already in use) 2008/08/01 08:25:01 [emerg] 257#0: still could not bind() .... and these errors just go on and on... If I run the nginx from the terminal, no error shown. Can anyone tell me what is wrong with my launchd file?

It works, but inside nginx error log, I see:
2008/08/01 08:24:50 [emerg] 244#0: bind() to 0.0.0.0:80 failed (48:
Address already in use)

Do you have apache already running on port 80? Check your “Web
Sharing” in System Preferences.

Jeff Emminger wrote:

It’s you again. Thank you for your reply.

Do you have apache already running on port 80? Check your “Web
Sharing” in System Preferences.

No, Web Sharing isn’t checked, and I don’t think any application other
than nginx is using port 80, because I can visit nginx server from the
port.

I notice a interesting thing however: whenever I kill the working nginx
process, a new nginx daemon will be started.
I think it is nginx itself trying to starts a new nginx daemon, even
when one nginx have been started and have occupied the port.But I don’t
know how two stop the new nginx stop trying.

I am sure I have just one launchd file loaded. Since If I delete or
unload the one, no working nginx can be found.

On Fri, Aug 01, 2008 at 02:46:10AM +0200, Nanyang Z. wrote:

com.zhan.nginx
It works, but inside nginx error log, I see:
2008/08/01 08:24:50 [emerg] 244#0: bind() to 0.0.0.0:80 failed (48:
Address already in use)

Looking in Apache’s plist, I see

    <key>ProgramArguments</key>
    <array>
            <string>/usr/sbin/httpd</string>
            <string>-D</string>
            <string>FOREGROUND</string>
    </array>

Probably you need to set “daemon off;” in nginx.conf.

BTW, upgrade to 0.7.8 if you are using case insensitive HFS+,
and do not use UTF-8 strings in locations.

I was having the same problem… Turning “daemon off;” in nginx.conf
worked great. Thanks!

Igor S. wrote:

On Fri, Aug 01, 2008 at 02:46:10AM +0200, Nanyang Z. wrote:

com.zhan.nginx
It works, but inside nginx error log, I see:
2008/08/01 08:24:50 [emerg] 244#0: bind() to 0.0.0.0:80 failed (48:
Address already in use)

Looking in Apache’s plist, I see

    <key>ProgramArguments</key>
    <array>
            <string>/usr/sbin/httpd</string>
            <string>-D</string>
            <string>FOREGROUND</string>
    </array>

Probably you need to set “daemon off;” in nginx.conf.

BTW, upgrade to 0.7.8 if you are using case insensitive HFS+,
and do not use UTF-8 strings in locations.