[MacPorts] #54194: nginx+launchd doesn't open port without -g

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[MacPorts] #54194: nginx+launchd doesn't open port without -g

MacPorts
#54194: nginx+launchd doesn't open port without -g
-----------------------+-------------------
 Reporter:  essandess  |      Owner:
     Type:  defect     |     Status:  new
 Priority:  Normal     |  Milestone:
Component:  ports      |    Version:
 Keywords:             |       Port:  nginx
-----------------------+-------------------
 {{{
 sudo port load nginx
 }}}

 doesn't open the port specified in the {{{nginx.conf}}} configuration
 because of an issue with launchd.

 This issue is widely known, e.g.,
 http://wiki.summercode.com/running_homebrewed_nginx_with_sudo_on_mac_os_x

 The way to get nginx to work with launchd is to add the {{{-g "daemon
 off;"}}} option in the plist.

 Here is a working launchd plist for nginx:

 {{{
 <?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>Label</key><string>org.macports.nginx</string>
 <key>ProgramArguments</key>
 <array>
         <string>/opt/local/bin/daemondo</string>
         <string>--label=nginx</string>
         <string>--start-cmd</string>
         <string>/opt/local/sbin/nginx</string>
         <string>-g</string>
         <string>&quot;daemon off;&quot;</string>
         <string>;</string>
         <string>--pid=fileauto</string>
         <string>--pidfile</string>
         <string>/opt/local/var/run/nginx/nginx.pid</string>
 </array>
 <key>Disabled</key><true/>
 <key>KeepAlive</key><true/>
 </dict>
 </plist>
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/54194>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54194: nginx+launchd doesn't open port without -g

MacPorts
#54194: nginx+launchd doesn't open port without -g
------------------------+-------------------------
  Reporter:  essandess  |      Owner:  Schamschula
      Type:  defect     |     Status:  closed
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:  fixed      |   Keywords:
      Port:  nginx      |
------------------------+-------------------------
Changes (by Schamschula):

 * status:  new => closed
 * owner:   => Schamschula
 * resolution:   => fixed


Comment:

 In [changeset:"40d449c9aa2a58731f37d8f17c4ba3ea76557b17/macports-ports"
 40d449c9aa2a58731f37d8f17c4ba3ea76557b17/macports-ports]:
 {{{
 #!ConfigurableCommitTicketReference repository="macports-ports"
 revision="40d449c9aa2a58731f37d8f17c4ba3ea76557b17"
 nginx: fix LaunchDaemon plist

 update lua variant to version 0.10.8
 Closes: https://trac.macports.org/ticket/54194
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/54194#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54194: nginx+launchd doesn't open port without -g

MacPorts
In reply to this post by MacPorts
#54194: nginx+launchd doesn't open port without -g
------------------------+-------------------------
  Reporter:  essandess  |      Owner:  Schamschula
      Type:  defect     |     Status:  closed
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:  fixed      |   Keywords:
      Port:  nginx      |
------------------------+-------------------------

Comment (by essandess):

 Thanks!

 BTW, I believe it may be necessary to close command line option settings
 with a semicolon: {{{-g "daemon off;"}}}

 I'd sanity check with a command line test.

--
Ticket URL: <https://trac.macports.org/ticket/54194#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54194: nginx+launchd doesn't open port without -g

MacPorts
In reply to this post by MacPorts
#54194: nginx+launchd doesn't open port without -g
------------------------+-------------------------
  Reporter:  essandess  |      Owner:  Schamschula
      Type:  defect     |     Status:  closed
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:  fixed      |   Keywords:
      Port:  nginx      |
------------------------+-------------------------

Comment (by Schamschula):

 Replying to [comment:2 essandess]:
 > Thanks!
 >
 > BTW, I believe it may be necessary to close command line option settings
 with a semicolon: {{{-g "daemon off;"}}}
 >
 > I'd sanity check with a command line test.

 I checked the plist before committing: The {{{;}}} is inserted
 automatically.

--
Ticket URL: <https://trac.macports.org/ticket/54194#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54194: nginx+launchd doesn't open port without -g

MacPorts
In reply to this post by MacPorts
#54194: nginx+launchd doesn't open port without -g
------------------------+-------------------------
  Reporter:  essandess  |      Owner:  Schamschula
      Type:  defect     |     Status:  closed
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:  fixed      |   Keywords:
      Port:  nginx      |
------------------------+-------------------------

Comment (by thetyrantcbass):

 After updating to nginx 1.13 the port no longer loads at all via launchd.
 Instead nginx just writes an error message every 30 seconds:


 {{{
 2017/05/20 06:05:18 [emerg] 213#0: unexpected end of parameter, expecting
 ";" in command line

 }}}

 And so on. The quotation or apostrophe marks are apparently required for
 the command to be properly executed:


 {{{
 sh-3.2# nginx -t -g daemon off;
 nginx: invalid option: "off"
 sh-3.2# nginx -t -g "daemon off;"
 nginx: the configuration file /opt/local/etc/nginx/nginx.conf syntax is ok
 nginx: configuration file /opt/local/etc/nginx/nginx.conf test is
 successful
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/54194#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54194: nginx+launchd doesn't open port without -g

MacPorts
In reply to this post by MacPorts
#54194: nginx+launchd doesn't open port without -g
------------------------+-------------------------
  Reporter:  essandess  |      Owner:  Schamschula
      Type:  defect     |     Status:  closed
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:  fixed      |   Keywords:
      Port:  nginx      |
------------------------+-------------------------

Comment (by Schamschula):

 It seems that the {{{;}}} location matters. Hopefully,

 https://github.com/macports/macports-
 ports/commit/61e3e885a4e7dced32d714673cf177278ebf41fd

 fixes this issue.

--
Ticket URL: <https://trac.macports.org/ticket/54194#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54194: nginx+launchd doesn't open port without -g

MacPorts
In reply to this post by MacPorts
#54194: nginx+launchd doesn't open port without -g
------------------------+-------------------------
  Reporter:  essandess  |      Owner:  Schamschula
      Type:  defect     |     Status:  closed
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:  fixed      |   Keywords:
      Port:  nginx      |
------------------------+-------------------------

Comment (by essandess):

 A semicolon is needed in the nginx {{{-g}}} option setting.

 The other semicolon is needed after the entire command for bash.

--
Ticket URL: <https://trac.macports.org/ticket/54194#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54194: nginx+launchd doesn't open port without -g

MacPorts
In reply to this post by MacPorts
#54194: nginx+launchd doesn't open port without -g
------------------------+-------------------------
  Reporter:  essandess  |      Owner:  Schamschula
      Type:  defect     |     Status:  closed
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:  fixed      |   Keywords:
      Port:  nginx      |
------------------------+-------------------------

Comment (by essandess):

 I believe these launchd and daemon issues are why Macports introduced
 daemondo.

 I am not sure if there are performance or scaling issues if nginx is run
 with {{{-g "daemon off;"}}}.

 Ideally, I believe there should be a Macports daemondo wrapper for Nginx,
 just like squid, polipo, and privoxy.

--
Ticket URL: <https://trac.macports.org/ticket/54194#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #54194: nginx+launchd doesn't open port without -g

MacPorts
In reply to this post by MacPorts
#54194: nginx+launchd doesn't open port without -g
------------------------+-------------------------
  Reporter:  essandess  |      Owner:  Schamschula
      Type:  defect     |     Status:  closed
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:  fixed      |   Keywords:
      Port:  nginx      |
------------------------+-------------------------

Comment (by thetyrantcbass):

 Starting fine for me now.

--
Ticket URL: <https://trac.macports.org/ticket/54194#comment:8>
MacPorts <https://www.macports.org/>
Ports system for macOS