diff options
author | Stuart Cardall <developer@it-offshore.co.uk> | 2017-01-03 00:43:33 +0000 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-01-11 01:38:22 +0100 |
commit | f30d57caf6336ee2ddb597658b4a398987c340f7 (patch) | |
tree | 23d7b4f191da7f5992209aa59f4b85d9705343de /testing/nginx-naxsi/nginx.initd | |
parent | 00813d387cd54a49a42860ae3385257770547cb3 (diff) | |
download | aports-f30d57caf6336ee2ddb597658b4a398987c340f7.tar.bz2 aports-f30d57caf6336ee2ddb597658b4a398987c340f7.tar.xz |
testing/nginx-naxsi: update to 1.11.8 with dynamic modules
Added support for dynamic modules
/usr/lib/nginx/modules:
3RD PARTY
================================
ngx_http_naxsi_module.so
ngx_http_cache_purge_module.so
ngx_http_upstream_fair_module.so
ngx_http_sysguard_module.so
* http-sysguard backported from tengine:
http://tengine.taobao.org/document/http_sysguard.html
CORE
================================
ngx_http_geoip_module.so
ngx_http_image_filter_module.so
ngx_http_perl_module.so
ngx_http_xslt_filter_module.so
ngx_mail_module.so
ngx_stream_module.so
----------------------------------------------------
To load dynamic modules add to /etc/nginx/nginx.conf
load_module "modules/ngx_module_name_above.so";
----------------------------------------------------
Diffstat (limited to 'testing/nginx-naxsi/nginx.initd')
-rw-r--r-- | testing/nginx-naxsi/nginx.initd | 79 |
1 files changed, 52 insertions, 27 deletions
diff --git a/testing/nginx-naxsi/nginx.initd b/testing/nginx-naxsi/nginx.initd index bec20dddaa..9e51e7dfa3 100644 --- a/testing/nginx-naxsi/nginx.initd +++ b/testing/nginx-naxsi/nginx.initd @@ -1,42 +1,67 @@ #!/sbin/openrc-run -extra_started_commands="reload" -extra_commands="configtest" +description="Nginx http and reverse proxy server" +extra_started_commands="reload reopen upgrade" + +cfgfile=${cfgfile:-/etc/nginx/nginx.conf} +pidfile=/run/nginx/nginx.pid +command=/usr/sbin/nginx +command_args="-c $cfgfile" +required_files="$cfgfile" depend() { need net use dns logger netmount } -CONFFILE=${CONFFILE:-/etc/nginx/${SVCNAME}.conf} -PIDFILE=${PIDFILE:-/var/run/${SVCNAME}.pid} - -configtest() { - ebegin "Checking ${SVCNAME} configuration" - mkdir -p /tmp/nginx - /usr/sbin/nginx -c ${CONFFILE} -t - eend $? "failed, please correct errors above" +start_pre() { + ebegin + checkpath --directory --owner nginx:nginx ${pidfile%/*} + $command $command_args -t -q + eend $? } -start() { - configtest || return 1 - ebegin "Starting ${SVCNAME}" - start-stop-daemon --start --pidfile "${PIDFILE}" \ - --exec /usr/sbin/nginx -- -c ${CONFFILE} -g "pid ${PIDFILE};" - eend $? "Failed to start ${SVCNAME}" +reload() { + ebegin "Reloading ${SVCNAME} configuration" + start_pre && start-stop-daemon --signal HUP --pidfile $pidfile + eend $? } -stop() { - configtest || return 1 - ebegin "Stopping ${SVCNAME}" - start-stop-daemon --stop --pidfile "${PIDFILE}" - eend $? "Failed to stop ${SVCNAME}" - rm -f "${PIDFILE}" +reopen() { + ebegin "Reopening ${SVCNAME} log files" + start-stop-daemon --signal USR1 --pidfile $pidfile + eend $? } -reload() { - configtest || return 1 - ebegin "Refreshing ${SVCNAME} configuration" - kill -HUP $(cat "${PIDFILE}") &>/dev/null - eend $? "Failed to reload nginx" +upgrade() { + start_pre || return 1 + + ebegin "Upgrading ${SVCNAME} binary" + + einfo "Sending USR2 to old binary" + start-stop-daemon --signal USR2 --pidfile $pidfile + + einfo "Sleeping 3 seconds before pid-files checking" + sleep 3 + + if [ ! -f $pidfile.oldbin ]; then + eerror "File with old pid ($pidfile.oldbin) not found" + return 1 + fi + + if [ ! -f $pidfile ]; then + eerror "New binary failed to start" + return 1 + fi + + einfo "Sleeping 3 seconds before WINCH" + sleep 3 ; start-stop-daemon --signal 28 --pidfile $pidfile.oldbin + + einfo "Sending QUIT to old binary" + start-stop-daemon --signal QUIT --pidfile $pidfile.oldbin + + einfo "Upgrade completed" + + eend $? "Upgrade failed" } + |