2018-03-09 02:31:14 +03:00
|
|
|
#!/usr/bin/env ssm
|
|
|
|
|
|
2026-11-27 16:14:30 +00:00
|
|
|
# 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.
|
|
|
|
|
|
2018-03-09 02:31:14 +03:00
|
|
|
service_respawn = on-failure
|
2026-11-27 16:14:30 +00:00
|
|
|
service_command = /usr/sbin/nginx
|
2018-03-09 02:31:14 +03:00
|
|
|
service_pidfile = /run/nginx.pid
|
2026-11-27 16:14:30 +00:00
|
|
|
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
|
|
|
|
|
}
|
2018-03-09 02:31:14 +03:00
|
|
|
|
2026-11-27 16:14:30 +00:00
|
|
|
# Do not send the reload signal if the config doesn't parse.
|
|
|
|
|
pre_reload() {
|
|
|
|
|
"$service_command" -t
|
|
|
|
|
}
|