summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSíle Ekaterin Liszka <sheila@vulpine.house>2023-10-29 11:56:03 -0700
committerSíle Ekaterin Liszka <sheila@vulpine.house>2023-10-29 11:56:03 -0700
commit5336c375a86a09f625952b0823845762d30932b9 (patch)
tree4b7a2fe34708d547a7e762303bec865d6c786be0
parentaa810ef31e326655790d0b0de54d8d19d611edd5 (diff)
downloadpackages-5336c375a86a09f625952b0823845762d30932b9.tar.gz
packages-5336c375a86a09f625952b0823845762d30932b9.tar.bz2
packages-5336c375a86a09f625952b0823845762d30932b9.tar.xz
packages-5336c375a86a09f625952b0823845762d30932b9.zip
user/nginx: new packagenew/nginx
-rw-r--r--user/nginx/APKBUILD83
-rw-r--r--user/nginx/nginx.conf28
-rw-r--r--user/nginx/nginx.initd71
-rw-r--r--user/nginx/nginx.pre-install4
4 files changed, 186 insertions, 0 deletions
diff --git a/user/nginx/APKBUILD b/user/nginx/APKBUILD
new file mode 100644
index 000000000..32272db05
--- /dev/null
+++ b/user/nginx/APKBUILD
@@ -0,0 +1,83 @@
+# Contributor: Síle Ekaterin Liszka <sheila@vulpine.house>
+# Maintainer: Síle Ekaterin Liszka <sheila@vulpine.house>
+pkgname=nginx
+pkgver=1.25.3
+pkgrel=0
+pkgdesc="High-performance HTTP server"
+url="https://nginx.org"
+arch="all"
+options="!check" # No test suite
+license="BSD-2-Clause"
+depends=""
+makedepends="openssl-dev pcre-dev zlib-dev"
+install="nginx.pre-install"
+pkgusers="nginx"
+pkggroups="nginx"
+subpackages="$pkgname-openrc"
+source="http://nginx.org/download/nginx-$pkgver.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_v3_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 \
+ --http-log-path=/var/log/nginx \
+ --error-log-path=/var/log/nginx/errors.log \
+ --with-stream=dynamic \
+ --with-stream_ssl_module \
+ --with-stream_realip_module \
+ --with-stream_ssl_preread_module
+ make
+}
+
+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="46fcbf6b540a2e47f192453b9686a701e3abe5a41a3275e36c9fca6c3f9ef0aa8d705cc5ad63257d662a5432109e4ce125d330cdeb547914bceac19e885dba1f nginx-1.25.3.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