#!/usr/bin/env ssm # nginx web server. # # nginx daemonizes itself (the parent returns after handing off to # workers), so we don't wait for the process to exit — we wait for the # port instead. service_respawn = on-failure service_command = /usr/sbin/nginx service_pidfile = /run/nginx.pid service_pidfile_timeout = 10 # ngs sometimes takes a moment to bind; poll until the socket answers. ready() { (exec 3<>/dev/tcp/127.0.0.1/80) 2>/dev/null } # Do not send the reload signal if the config doesn't parse. pre_reload() { "$service_command" -t }