# Mac os nginx startup launchd configure

**URL:** <https://www.ruby-forum.com/t/mac-os-nginx-startup-launchd-configure/144673>\
**Category:** NGINX\
**Created:** [August 1, 2008, 2:46am UTC](https://www.ruby-forum.com/t/mac-os-nginx-startup-launchd-configure/144673 "2008-08-01T02:46:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/82dd89/32.png) [@xain](https://www.ruby-forum.com/u/xain)\
**Post date:** [August 1, 2008, 2:46am UTC](https://www.ruby-forum.com/t/mac-os-nginx-startup-launchd-configure/144673/1 "2008-08-01T02:46:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![xain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/82dd89/32.png) [@xain](https://www.ruby-forum.com/u/xain)\
**Post date:** [August 1, 2008, 3:35am UTC](https://www.ruby-forum.com/t/mac-os-nginx-startup-launchd-configure/144673/2 "2008-08-01T03:35:27Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![xain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/82dd89/32.png) [@xain](https://www.ruby-forum.com/u/xain)\
**Post date:** [August 1, 2008, 7:09am UTC](https://www.ruby-forum.com/t/mac-os-nginx-startup-launchd-configure/144673/3 "2008-08-01T07:09:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![xain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/82dd89/32.png) [@xain](https://www.ruby-forum.com/u/xain)\
**Post date:** [August 1, 2008, 8:14am UTC](https://www.ruby-forum.com/t/mac-os-nginx-startup-launchd-configure/144673/4 "2008-08-01T08:14:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![xain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/82dd89/32.png) [@xain](https://www.ruby-forum.com/u/xain)\
**Post date:** [September 12, 2008, 7:32pm UTC](https://www.ruby-forum.com/t/mac-os-nginx-startup-launchd-configure/144673/5 "2008-09-12T19:32:53Z")

</div>

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.
