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"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>com.zhan.nginx</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/opt/local/sbin/nginx</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
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?
on 2008-08-01 02:46
on 2008-08-01 03:35
> 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.
on 2008-08-01 07:09
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 2008-08-01 08:14
On Fri, Aug 01, 2008 at 02:46:10AM +0200, Nanyang Zhan wrote: > <string>com.zhan.nginx</string> > 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.
on 2008-09-12 19:32
I was having the same problem... Turning "daemon off;" in nginx.conf worked great. Thanks! Igor Sysoev wrote: > On Fri, Aug 01, 2008 at 02:46:10AM +0200, Nanyang Zhan wrote: > >> <string>com.zhan.nginx</string> >> 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.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.