summaryrefslogtreecommitdiff
path: root/skip/apache2
diff options
context:
space:
mode:
Diffstat (limited to 'skip/apache2')
-rw-r--r--skip/apache2/alpine.layout22
-rw-r--r--skip/apache2/apache2-ssl.post-install30
-rw-r--r--skip/apache2/apache2.confd54
-rwxr-xr-xskip/apache2/apache2.initd154
-rw-r--r--skip/apache2/apache2.logrotate10
-rw-r--r--skip/apache2/apache2.pre-install8
-rw-r--r--skip/apache2/apache2.pre-upgrade8
-rw-r--r--skip/apache2/apache2.xibuild119
8 files changed, 405 insertions, 0 deletions
diff --git a/skip/apache2/alpine.layout b/skip/apache2/alpine.layout
new file mode 100644
index 0000000..e9c948f
--- /dev/null
+++ b/skip/apache2/alpine.layout
@@ -0,0 +1,22 @@
+<Layout Alpine>
+ prefix: /usr
+ exec_prefix: ${prefix}
+ bindir: ${prefix}/bin
+ sbindir: ${prefix}/sbin
+ libdir: ${prefix}/lib
+ libexecdir: ${prefix}/lib+
+ mandir: ${prefix}/share/man
+ sysconfdir: /etc+
+ datadir: ${prefix}/share+
+ installbuilddir: ${datadir}/build
+ errordir: ${datadir}/error
+ iconsdir: ${datadir}/icons
+ htdocsdir: /var/www/localhost/htdocs
+ manualdir: /usr/share/doc/apache2/manual
+ cgidir: /var/www/localhost/cgi-bin
+ includedir: /usr/include+
+ localstatedir: /var
+ runtimedir: /run+
+ logfiledir: ${localstatedir}/log+
+ proxycachedir: ${localstatedir}/cache+
+</Layout>
diff --git a/skip/apache2/apache2-ssl.post-install b/skip/apache2/apache2-ssl.post-install
new file mode 100644
index 0000000..1e8478a
--- /dev/null
+++ b/skip/apache2/apache2-ssl.post-install
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+ssldir=/etc/ssl/apache2
+sslkey=$ssldir/server.key
+sslcert=$ssldir/server.pem
+
+umask 077
+
+[ -f $sslkey ] || openssl genrsa 2048 > $sslkey 2>/dev/null
+
+FQDN=`hostname -f`
+if [ "x${FQDN}" = "x" ]; then
+ FQDN=localhost.localdomain
+fi
+
+if [ ! -f ${sslcert} ] ; then
+cat << EOF | openssl req -new -key ${sslkey} \
+ -x509 -days 365 -set_serial $RANDOM \
+ -out ${sslcert} 2>/dev/null
+--
+SomeState
+SomeCity
+SomeOrganization
+SomeOrganizationalUnit
+${FQDN}
+root@${FQDN}
+EOF
+fi
+
+
diff --git a/skip/apache2/apache2.confd b/skip/apache2/apache2.confd
new file mode 100644
index 0000000..aeb3222
--- /dev/null
+++ b/skip/apache2/apache2.confd
@@ -0,0 +1,54 @@
+# /etc/conf.d/apache2: config file for /etc/init.d/apache2
+
+#
+# The default processing model (MPM) is the process-based
+# 'prefork' model. A thread-based model, 'worker', is also
+# available, but does not work with some modules (such as PHP).
+#
+#HTTPD=/usr/sbin/httpd.worker
+
+HTTPD="/usr/sbin/httpd"
+
+#
+# To pass additional options (for instance, -D definitions) to the
+# httpd binary at startup, set HTTPD_OPTS here.
+#
+HTTPD_OPTS=
+
+# Extended options for advanced uses of Apache ONLY
+# You don't need to edit these unless you are doing crazy Apache stuff
+# As not having them set correctly, or feeding in an incorrect configuration
+# via them will result in Apache failing to start
+# YOU HAVE BEEN WARNED.
+
+# PID file
+#PIDFILE=/run/apache2/httpd.pid
+
+# timeout for startup/shutdown checks
+#TIMEOUT=10
+
+# ServerRoot setting
+#SERVERROOT=/var/www
+
+# Configuration file location
+# - If this does NOT start with a '/', then it is treated relative to
+# $SERVERROOT by Apache
+#CONFIGFILE=/etc/apache2/httpd.conf
+
+# Location to log startup errors to
+# They are normally dumped to your terminal.
+#STARTUPERRORLOG="/var/log/apache2/startuperror.log"
+
+# A command that outputs a formatted text version of the HTML at the URL
+# of the command line. Designed for lynx, however other programs may work.
+#LYNX="lynx -dump"
+
+# The URL to your server's mod_status status page.
+# Required for status and fullstatus
+#STATUSURL="http://localhost/server-status"
+
+# Method to use when reloading the server
+# Valid options are 'restart' and 'graceful'
+# See http://httpd.apache.org/docs/2.2/stopping.html for information on
+# what they do and how they differ.
+#RELOAD_TYPE="graceful"
diff --git a/skip/apache2/apache2.initd b/skip/apache2/apache2.initd
new file mode 100755
index 0000000..2975e7a
--- /dev/null
+++ b/skip/apache2/apache2.initd
@@ -0,0 +1,154 @@
+#!/sbin/openrc-run
+
+extra_commands="configdump configtest modules virtualhosts"
+extra_started_commands="fullstatus graceful gracefulstop reload"
+
+depend() {
+ need net
+ use mysql dns logger netmount postgresql
+ after sshd firewall
+}
+
+configtest() {
+ ebegin "Checking ${SVCNAME} configuration"
+ checkconfig
+ eend $?
+}
+
+checkconfd() {
+ PIDFILE="${PIDFILE:-/run/apache2/httpd.pid}"
+ TIMEOUT=${TIMEOUT:-10}
+
+ SERVERROOT="${SERVERROOT:-/var/www}"
+ if [ ! -d ${SERVERROOT} ]; then
+ eerror "SERVERROOT does not exist: ${SERVERROOT}"
+ return 1
+ fi
+
+ CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}"
+ [ "${CONFIGFILE#/}" = "${CONFIGFILE}" ] && CONFIGFILE="${SERVERROOT}/${CONFIGFILE}"
+ if [ ! -r "${CONFIGFILE}" ]; then
+ eerror "Unable to read configuration file: ${CONFIGFILE}"
+ return 1
+ fi
+
+ HTTPD_OPTS="${HTTPD_OPTS} -d ${SERVERROOT}"
+ HTTPD_OPTS="${HTTPD_OPTS} -f ${CONFIGFILE}"
+ [ -n "${STARTUPERRORLOG}" ] && HTTPD_OPTS="${HTTPD_OPTS} -E ${STARTUPERRORLOG}"
+ return 0
+
+}
+
+checkconfig() {
+ checkconfd || return 1
+
+ ${HTTPD} ${HTTPD_OPTS} -t 1>/dev/null 2>&1
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eerror "${SVCNAME} has detected an error in your setup:"
+ ${HTTPD} ${HTTPD_OPTS} -t
+ fi
+
+ return $ret
+}
+
+start() {
+ checkconfig || return 1
+ checkpath --directory $(dirname $PIDFILE)
+
+ [ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache
+
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start \
+ --pidfile ${PIDFILE} \
+ --exec ${HTTPD} \
+ -- ${HTTPD_OPTS} -k start
+ eend $?
+}
+
+stop() {
+ checkconfd || return 1
+
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --pidfile ${PIDFILE} --exec ${HTTPD} \
+ --retry ${TIMEOUT}
+ eend $?
+}
+
+reload() {
+ RELOAD_TYPE="${RELOAD_TYPE:-graceful}"
+
+ checkconfig || return 1
+ service_started "${SVCNAME}" || return
+
+ if [ "${RELOAD_TYPE}" = "restart" ]; then
+ ebegin "Restarting ${SVCNAME}"
+ ${HTTPD} ${HTTPD_OPTS} -k restart
+ eend $?
+ elif [ "${RELOAD_TYPE}" = "graceful" ]; then
+ ebegin "Gracefully restarting ${SVCNAME}"
+ ${HTTPD} ${HTTPD_OPTS} -k graceful
+ eend $?
+ else
+ eerror "${RELOAD_TYPE} is not a valid RELOAD_TYPE. Please edit /etc/conf.d/${SVCNAME}"
+ fi
+}
+
+graceful() {
+ checkconfig || return 1
+ service_started "${SVCNAME}" || return
+ ebegin "Gracefully restarting ${SVCNAME}"
+ ${HTTPD} ${HTTPD_OPTS} -k graceful
+ eend $?
+}
+
+gracefulstop() {
+ checkconfig || return 1
+ ebegin "Gracefully stopping ${SVCNAME}"
+ start-stop-daemon --stop --pidfile ${PIDFILE} --exec ${HTTPD} \
+ --retry SIGWINCH/${TIMEOUT}
+ eend $?
+}
+
+modules() {
+ checkconfig || return 1
+
+ ${HTTPD} ${HTTPD_OPTS} -M 2>&1
+}
+
+fullstatus() {
+ LYNX="${LYNX:-lynx -dump}"
+ STATUSURL="${STATUSURL:-http://localhost/server-status}"
+
+ if ! service_started "${SVCNAME}"; then
+ eerror "${SVCNAME} not started"
+ elif ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then
+ eerror "lynx not installed!"
+ else
+ ${LYNX} ${STATUSURL}
+ fi
+}
+
+virtualhosts() {
+ checkconfd || return 1
+ ${HTTPD} ${HTTPD_OPTS} -S
+}
+
+configdump() {
+ LYNX="${LYNX:-lynx -dump}"
+ INFOURL="${INFOURL:-http://localhost/server-info}"
+
+ checkconfd || return 1
+
+ if ! service_started "${SVCNAME}"; then
+ eerror "${SVCNAME} not started"
+ elif ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then
+ eerror "lynx not installed!"
+ else
+ echo "${HTTPD} started with '${HTTPD_OPTS}'"
+ for i in config server list; do
+ ${LYNX} "${INFOURL}/?${i}" | sed '/Apache Server Information/d;/^[[:space:]]\+[_]\+$/Q'
+ done
+ fi
+}
+
diff --git a/skip/apache2/apache2.logrotate b/skip/apache2/apache2.logrotate
new file mode 100644
index 0000000..b50fb71
--- /dev/null
+++ b/skip/apache2/apache2.logrotate
@@ -0,0 +1,10 @@
+/var/log/apache2/*log {
+ missingok
+ notifempty
+ sharedscripts
+ delaycompress
+ postrotate
+ /etc/init.d/apache2 --quiet --ifstarted reload > /dev/null 2>/dev/null || true
+ endscript
+}
+
diff --git a/skip/apache2/apache2.pre-install b/skip/apache2/apache2.pre-install
new file mode 100644
index 0000000..d4ede74
--- /dev/null
+++ b/skip/apache2/apache2.pre-install
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+addgroup -S -g 82 www-data 2>/dev/null
+addgroup -S apache 2>/dev/null
+adduser -S -D -H -h /var/www -s /sbin/nologin -G apache -g apache apache 2>/dev/null
+addgroup apache www-data 2>/dev/null
+
+exit 0
diff --git a/skip/apache2/apache2.pre-upgrade b/skip/apache2/apache2.pre-upgrade
new file mode 100644
index 0000000..d4ede74
--- /dev/null
+++ b/skip/apache2/apache2.pre-upgrade
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+addgroup -S -g 82 www-data 2>/dev/null
+addgroup -S apache 2>/dev/null
+adduser -S -D -H -h /var/www -s /sbin/nologin -G apache -g apache apache 2>/dev/null
+addgroup apache www-data 2>/dev/null
+
+exit 0
diff --git a/skip/apache2/apache2.xibuild b/skip/apache2/apache2.xibuild
new file mode 100644
index 0000000..f2de5a4
--- /dev/null
+++ b/skip/apache2/apache2.xibuild
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+NAME="apache2"
+DESC="A high performance Unix-based HTTP server"
+
+MAKEDEPS=" apr apr-util autoconf automake brotli libxml2 lua nghttp2 openssl-dev>3 pcre sed zlib"
+
+_pkgreal=httpd
+
+PKG_VER=2.4.54
+SOURCE="https://dlcdn.apache.org/$_pkgreal/$_pkgreal-$PKG_VER.tar.bz2"
+
+ADDITIONAL="
+alpine.layout
+apache2-ssl.post-install
+apache2.confd
+apache2.initd
+apache2.logrotate
+apache2.pre-install
+apache2.pre-upgrade
+conf
+"
+
+prepare() {
+ for i in $source; do
+ case $i in
+ *.patch) echo $i; patch -p1 -i "$BUILD_ROOT"/$(basename $i);;
+ esac
+ done
+
+ cat "$BUILD_ROOT/alpine.layout" >> config.layout
+}
+
+build() {
+ ./configure \
+ --prefix=/usr \
+ --enable-so \
+ --enable-suexec \
+ --with-suexec-caller=apache \
+ --with-suexec-docroot=/var/www \
+ --with-suexec-logfile=/var/log/apache2/suexec.log \
+ --with-suexec-bin=/usr/sbin/suexec \
+ --with-suexec-uidmin=99 \
+ --with-suexec-gidmin=99 \
+ --with-apr=/usr/bin/apr-1-config \
+ --with-apr-util=/usr/bin/apu-1-config \
+ --with-pcre=/usr \
+ --enable-mods-shared=all \
+ --enable-mpms-shared=all \
+ --with-mpm=prefork \
+ --enable-ssl \
+ --with-ssl \
+ --enable-proxy \
+ --enable-cache \
+ --enable-disk-cache \
+ --enable-mem-cache \
+ --enable-file-cache \
+ --enable-ldap \
+ --enable-authnz-ldap \
+ --enable-cgid \
+ --enable-cgi \
+ --enable-authn-anon \
+ --enable-authn-alias \
+ --disable-imagemap \
+ --enable-proxy-connect \
+ --enable-proxy-http \
+ --enable-proxy-ftp \
+ --enable-deflate \
+ --enable-dbd \
+ --enable-exception-hook \
+ --enable-dav \
+ --enable-dav-fs \
+ --enable-dav-lock
+ make
+}
+
+package() {
+ make -j1 DESTDIR="$PKG_DEST" install
+
+ # config
+ rm -r "$PKG_DEST"/etc/apache2/extra/httpd-vhosts.conf \
+ "$PKG_DEST"/etc/apache2/original
+ mv "$PKG_DEST"/etc/apache2/extra "$PKG_DEST"/etc/apache2/conf.d
+ for file in "$PKG_DEST"/etc/apache2/conf.d/httpd-*; do
+ mv "$file" \
+ "$(dirname $file)/${file#$PKG_DEST/etc/apache2/conf.d/httpd-}"
+ done
+ sed -Ei \
+ 's:^(\t?#?LoadModule .+ )lib/apache2/:\1modules/:;ta;b;:a;s/^#?LoadModule (dav.*|lbmethod_.+|.*ldap|lua|proxy.*|ssl|xml2enc)_module //;tb;b;:b;d' \
+ "$PKG_DEST"/etc/apache2/httpd.conf
+
+ # init scripts and logrotate
+ install -D -m755 "$BUILD_ROOT"/apache2.initd \
+ "$PKG_DEST"/etc/init.d/apache2
+ install -D -m644 "$BUILD_ROOT"/apache2.logrotate \
+ "$PKG_DEST"/etc/logrotate.d/apache2
+ install -D -m644 "$BUILD_ROOT"/apache2.confd \
+ "$PKG_DEST"/etc/conf.d/apache2
+
+ install -d "$PKG_DEST"/var/www
+ install -d -m 2750 -g wheel "$PKG_DEST"/var/log/apache2
+ ln -fs /var/log/apache2 "$PKG_DEST"/var/www/logs
+ ln -fs /run/apache2 "$PKG_DEST"/var/www/run
+ ln -fs /usr/lib/apache2 "$PKG_DEST"/var/www/modules
+ rm -fr "$PKG_DEST"/run
+
+ # verify all MPMs are built
+ # ref #2866
+ for i in prefork event worker; do
+ if ! [ -e "$PKG_DEST"/usr/lib/apache2/mod_mpm_$i.so ]; then
+ error "$i MPM was not built"
+ fi
+ done
+
+ # create the run directory
+ # ref #9982
+ mkdir -p "$PKG_DEST"/run/apache2
+}
+