diff options
Diffstat (limited to 'user')
-rw-r--r-- | user/nginx/APKBUILD | 92 | ||||
-rw-r--r-- | user/nginx/nginx.conf | 28 | ||||
-rw-r--r-- | user/nginx/nginx.initd | 71 | ||||
-rw-r--r-- | user/nginx/nginx.pre-install | 4 |
4 files changed, 195 insertions, 0 deletions
diff --git a/user/nginx/APKBUILD b/user/nginx/APKBUILD new file mode 100644 index 000000000..da4950239 --- /dev/null +++ b/user/nginx/APKBUILD @@ -0,0 +1,92 @@ +# Contributor: Síle Ekaterin Liszka <sheila@vulpine.house> +# Maintainer: Síle Ekaterin Liszka <sheila@vulpine.house> +pkgname=nginx +pkgver=1.26.1 +pkgrel=0 +_testsuite_rev=24482e311749 +pkgdesc="High-performance HTTP server" +url="https://nginx.org" +arch="all" +options="" +license="BSD-2-Clause" +depends="" +makedepends="openssl-dev pcre2-dev zlib-dev" +checkdepends="openssl cmd:which" +install="nginx.pre-install" +pkgusers="nginx" +pkggroups="nginx" +subpackages="$pkgname-openrc" +source="https://nginx.org/download/nginx-$pkgver.tar.gz + $pkgname-tests-${_testsuite_rev}.tar.gz::https://hg.nginx.org/nginx-tests/archive/${_testsuite_rev}.tar.gz + + nginx.initd + nginx.conf + " + +build() { + ./configure \ + --build=$CBUILD \ + --prefix=/usr \ + --modules-path=/usr/libexec/nginx \ + --conf-path=/etc/nginx/ \ + --pid-path=/run/nginx \ + --lock-path=/run/nginx \ + --user=nginx \ + --group=nginx \ + --with-poll_module \ + --with-threads \ + --with-file-aio \ + --with-http_ssl_module \ + --with-http_v2_module \ + --with-http_realip_module \ + --with-http_dav_module \ + --with-http_auth_request_module \ + --without-http_ssi_module \ + --without-http_empty_gif_module \ + --without-http_geo_module \ + --with-stream=dynamic \ + --with-stream_ssl_module \ + --with-stream_realip_module \ + --with-stream_ssl_preread_module + make +} + +check() { + cd "$srcdir"/nginx-tests-${_testsuite_rev} + + TEST_NGINX_BINARY="$builddir/objs/nginx" prove -j ${JOBS} . +} + +package() { + mkdir -p "$pkgdir"/usr/sbin + install -Dm755 objs/nginx "$pkgdir"/usr/sbin/nginx + + mkdir -p "$pkgdir"/etc/init.d + install -Dm755 "$srcdir"/nginx.initd "$pkgdir"/etc/init.d/nginx + + mkdir -p "$pkgdir"/etc/nginx + for i in koi-win koi-utf win-utf mime.types; do + install -Dm644 conf/$i "$pkgdir"/etc/nginx + done + install -Dm644 "$srcdir"/nginx.conf "$pkgdir"/etc/nginx + + mkdir -p "$pkgdir"/etc/nginx/conf.d + for i in fastcgi scgi uwsgi; do + install -Dm644 conf/${i}_params "$pkgdir"/etc/nginx/conf.d/"$i".conf + done + + mkdir -p "$pkgdir"/usr/libexec/nginx + for i in objs/ngx_*_module.so; do + install -Dm755 "$i" "$pkgdir"/usr/libexec/nginx + done + + mkdir -p "$pkgdir"/var/www/nginx/localhost + for i in html/*.html; do + install -Dm644 "$i" "$pkgdir"/var/www/nginx/localhost + done +} + +sha512sums="dfaadde78eb5cf8c8c3a43ead9ac49fc852c8de3e70e69754e3ffafc88c50c8bc08cdac0cc0ba8a9d8c155bdb334865e2e6c7dc1144c79959c426a9e087b3e37 nginx-1.26.1.tar.gz +80d163226bdbfcf4bd8556316a1dcc5b048fa87357f83f5cac3b13917043dad0c96b9bc67ac886b421cc4954ddf7603256fe77d85fda406f8ed8c9231fc1cf3e nginx-tests-24482e311749.tar.gz +eb183860cd511361346e4079c1fcf470985e1c3b2a034a57f8b2a92ba851fed99256261f9b779770a5f57e3750e9e71bd1550a9d19ad9bf3a4d288864f0374a2 nginx.initd +9f0583ebccf265d7fd5eac6afbe2bb8f6364e399b0ca9edc09f0c51996bf2b60348bddd8d8f7600a52a56e930d496a36c178b9f16cde30843417858bb613c850 nginx.conf" diff --git a/user/nginx/nginx.conf b/user/nginx/nginx.conf new file mode 100644 index 000000000..204d667d5 --- /dev/null +++ b/user/nginx/nginx.conf @@ -0,0 +1,28 @@ +# This is an example configuration file for nginx, with a number of secure +# defaults specified already. + +# The system user that nginx runs under. +user nginx; + +# The number of worker processes nginx should have. 'Auto' allows nginx +# to determine for itself; typically this value should be the number of +# cores you wish nginx to use. +worker_processes auto; + +# HTTP-specific configuration +http { + # Default mapping of MIME types to file extensions. + include mime.types; + + # The default MIME type to use for unknown extensions. + default_type application/octet-stream; + + # This setting enables gzip-based compression, reducing bandwidth usage. + gzip on; + + # Global configuration. + include conf.d/*.conf; + + # Site configuration. + include sites.d/*.conf; +} diff --git a/user/nginx/nginx.initd b/user/nginx/nginx.initd new file mode 100644 index 000000000..603f91e63 --- /dev/null +++ b/user/nginx/nginx.initd @@ -0,0 +1,71 @@ +#!/sbin/openrc-run + +description="Nginx http and reverse proxy server" +extra_commands="checkconfig" +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 +} + +start_pre() { + checkpath --directory --owner nginx:nginx ${pidfile%/*} + $command $command_args -t -q +} + +checkconfig() { + ebegin "Checking $RC_SVCNAME configuration" + start_pre + eend $? +} + +reload() { + ebegin "Reloading $RC_SVCNAME configuration" + start_pre && start-stop-daemon --signal HUP --pidfile $pidfile + eend $? +} + +reopen() { + ebegin "Reopening $RC_SVCNAME log files" + start-stop-daemon --signal USR1 --pidfile $pidfile + eend $? +} + +upgrade() { + start_pre || return 1 + + ebegin "Upgrading $RC_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" +} diff --git a/user/nginx/nginx.pre-install b/user/nginx/nginx.pre-install new file mode 100644 index 000000000..da22bde54 --- /dev/null +++ b/user/nginx/nginx.pre-install @@ -0,0 +1,4 @@ +#!/bin/sh + +groupadd -r -f -g 82 www-data >/dev/null +useradd -d /var/lib/nginx -G www-data -r -M -s /sbin/nologin -U >/dev/null |