diff options
author | Adis Nezirovic <adis _at_ linux.org.ba> | 2010-05-11 15:01:25 +0200 |
---|---|---|
committer | Michiel van Wessem <michiel@slackbuilds.org> | 2010-05-11 15:01:25 +0200 |
commit | 8b1d64e6426358bf91f653e3c5e8c163fc9ab195 (patch) | |
tree | b7c0b86bda8cef082c45ebca5897444b72e0670a | |
parent | ba8516468d9f8a1db8129c9d49ac5dc4aa9df5ff (diff) | |
download | slackbuilds-8b1d64e6426358bf91f653e3c5e8c163fc9ab195.tar.gz |
network/apache2: Initial import
-rw-r--r-- | network/apache2/README | 28 | ||||
-rw-r--r-- | network/apache2/TODO | 1 | ||||
-rw-r--r-- | network/apache2/apache2.SlackBuild | 176 | ||||
-rw-r--r-- | network/apache2/apache2.info | 8 | ||||
-rw-r--r-- | network/apache2/doinst.sh | 20 | ||||
-rw-r--r-- | network/apache2/logrotate.apache | 9 | ||||
-rw-r--r-- | network/apache2/patches/config.layout.patch | 30 | ||||
-rw-r--r-- | network/apache2/patches/httpd.conf.diff | 63 | ||||
-rw-r--r-- | network/apache2/patches/httpd_extra.diff | 40 | ||||
-rw-r--r-- | network/apache2/rc.httpd | 37 | ||||
-rw-r--r-- | network/apache2/slack-desc | 12 |
11 files changed, 424 insertions, 0 deletions
diff --git a/network/apache2/README b/network/apache2/README new file mode 100644 index 0000000000..d48a4ae795 --- /dev/null +++ b/network/apache2/README @@ -0,0 +1,28 @@ +WARNING +This script builds a package that conflicts with Slackware's apache1 and +thus should be installed using upgradepkg if another version of apache +is currently installed. + +Apache is the most popular web server in the known universe; over half +the servers on the Internet are running Apache or one of its variants. + +By default, we build apache2 with the traditional "apache prefork" multi +processing module (MPM). This is somewhat safer for the use of mod_php, +but can still carry some security risks (all your php scripts run as the +user configured to run apache2). This is mitigated by default, as +apache2 runs as user apache2 and group apache2, which do not exist on +default Slackware installations and should have minimal privilages. + +For enhanced multi-threaded performance, use "apache worker", but using +mod_php with "worker" is considered dangerous. PHP Core is multi-thread +safe, but many PHP extensions are *NOT*. To build apache2 with the +worker MPM, just run the script like so: + + # MPM_FLAVOR=worker; ./apache2.SlackBuild + +Please note that this script does not build apache2 with SuEXEC support. +If you need this functionality, please read the following documentation +and make the necessary changes to the ./configure options in the script. + + http://httpd.apache.org/docs/2.0/suexec.html + diff --git a/network/apache2/TODO b/network/apache2/TODO new file mode 100644 index 0000000000..1fa4888350 --- /dev/null +++ b/network/apache2/TODO @@ -0,0 +1 @@ +- maybe impliment FLAVOR=usr and FLAVOR=opt? diff --git a/network/apache2/apache2.SlackBuild b/network/apache2/apache2.SlackBuild new file mode 100644 index 0000000000..0cae1ff00a --- /dev/null +++ b/network/apache2/apache2.SlackBuild @@ -0,0 +1,176 @@ +#!/bin/bash + +## Slackware build for Apache 2.2 +## +## Version: 2.1.0 +## Date: 2007-02-26 +## Copyright (c) 2007 Adis Nezirović <adis _at_ linux.org.ba> +## Licensed under GNU GPL v2 + +# Modified by the SlackBuilds.org team <http://www.slackbuilds.org> + +# Exit on errors +set -e + +PRGNAM=apache +VERSION=2.2.4 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-2} +TAG=${TAG:-_SBo} +CWD=$(pwd) +TMP=/tmp/SBo +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +ORIG_PRGNAM=httpd + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -fomit-frame-pointer -pipe" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2" +fi + +## Apache user & group. *MUST* exist before package creation +# See http://slackbuilds.org/uid_gid.txt for current recomendations. +# If you change this, please update httpd.conf.diff in patches directory. +HTTPD_USER=apache2 +HTTPD_GROUP=apache2 + +if ! grep ^$HTTPD_GROUP: /etc/group > /dev/null 2>&1; then + echo "$0: Error: HTTP group ($HTTPD_GROUP) doesn't exist." + echo "$0: Try creating one with: groupadd -g 207 $HTTPD_GROUP" + exit 1 +fi + +if ! grep ^$HTTPD_USER: /etc/passwd > /dev/null 2>&1; then + echo "$0: Error: HTTP user ($HTTPD_USER) doesn't exist." + echo "$0: Try creating one with: useradd -u 207 -g $HTTPD_GROUP -d /var/www $HTTPD_USER" + exit 1 +fi + +# MPM_FLAVOR lets the user enable their choice of apache2 multiprocessing module: +# 'worker' is multithreaded module +# 'prefork' is "old style" process based module +# +# If you want or *must* use mod_php, select "prefork", but consider +# security issues (all your php scripts run as apache user) +# The opposite aproach is to use SuEXEC + mod_fcgid + php-cgi, with "worker" MPM +# +# We've chosen prefork as the default, because it will work with mod_php. +# worker should not be used for mod_php as many php extensions are not +# thread safe. To select worker, just run this script like so: +# +# MPM_FLAVOR=worker; ./apache2.SlackBuild +MPM_FLAVOR=${MPM_FLAVOR:-"prefork"} + +# Make sure we start from clean state +rm -rf $TMP/$PRGNAM-$VERSION $PKG + +# Output directories +mkdir -p $TMP $PKG $OUTPUT $CWD/patches +mkdir -p $PKG/{install,etc/rc.d,etc/apache2,srv/www/vhosts,etc/logrotate.d} + +cd $TMP +tar xjvf $CWD/$ORIG_PRGNAM-$VERSION.tar.bz2 +mv $TMP/$ORIG_PRGNAM-$VERSION $TMP/$PRGNAM-$VERSION +cd $TMP/$PRGNAM-$VERSION + +# patch config.layout to comply with FHS (except we use libexec dir) +patch --verbose -p1 < $CWD/patches/config.layout.patch + +## Fix permissions and ownership +chmod -R a-s,u+w,go+r-w . +chown -R root:root . + +## To enable SuEXEC support pass +## following options to configure: +# +# --enable-suexec \ +# --with-suexec-bin=/usr/sbin/suexec \ +# --with-suexec-docroot=/var/www \ +# --with-suexec-caller=apache2 \ +# --with-suexec-uidmin=1000 \ +# --with-suexec-gidmin=1000 \ +# +## Defaults for suexec-uidmin suexec-gidmin are 100/100 +## but I don't like system accounts running web scripts + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --enable-layout=Slackware-FHS \ + --with-mpm=$MPM_FLAVOR \ + --with-apr=/usr \ + --with-apr-util=/usr \ + --enable-so \ + --enable-modules=most \ + --enable-mods-shared=most \ + --enable-cgi \ + --enable-ssl \ + --enable-rewrite \ + --enable-vhost-alias \ + --enable-cache \ + --enable-file-cache \ + --enable-disk-cache \ + --enable-mem-cache \ + --enable-proxy \ + --enable-proxy-http \ + --enable-proxy-ftp \ + --enable-proxy-balancer \ + --disable-speling \ + --enable-dav \ + --enable-ldap \ + || exit 1 + +make || exit 1 +make DESTDIR=$PKG install || exit 1 + +## Tweak default apache configuration +cd $PKG/etc/apache2 +patch --verbose -p1 < $CWD/patches/httpd.conf.diff +patch --verbose -p1 < $CWD/patches/httpd_extra.diff + +chmod 700 $PKG/var/log/apache2 + +## strip +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +## gzip man pages +gzip -9 $PKG/usr/man/man?/* + +## copy startup script +cp $CWD/rc.httpd $PKG/etc/rc.d/rc.httpd.new + +## copy logrotate script +cp $CWD/logrotate.apache $PKG/etc/logrotate.d/apache + +## add description file and install script +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +## add documentation +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/ +cat $CWD/apache2.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/apache2.SlackBuild +rm -fr $PKG/opt/apache2/share/manual +cp -a $TMP/$PRGNAM-$VERSION/{ABOUT_APACHE,CHANGES,INSTALL,LAYOUT,LICENSE,NOTICE,README,ROADMAP,VERSIONING,docs} \ + $PKG/usr/doc/$PRGNAM-$VERSION + +## We don't want to overwrite config files +cd $PKG/etc/apache2 +mv httpd.conf httpd.conf.new + +for conf_file in extra/*; do + mv $conf_file "$conf_file.new"; +done + +# Don't need this laying around. +rm $PKG/etc/apache2/httpd.conf~ + +# and finally, make the package +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/network/apache2/apache2.info b/network/apache2/apache2.info new file mode 100644 index 0000000000..2b85675c38 --- /dev/null +++ b/network/apache2/apache2.info @@ -0,0 +1,8 @@ +PRGNAM="apache2" +VERSION="2.2.4" +HOMEPAGE="http://www.apache.org" +DOWNLOAD="http://www.eu.apache.org/dist/httpd/httpd-2.2.4.tar.bz2" +MD5SUM="536c86c7041515a25dd8bad3611da9a3" +MAINTAINER="Adis Nezirovic" +EMAIL="adis _at_ linux.org.ba" +APPROVED="BP{k}" diff --git a/network/apache2/doinst.sh b/network/apache2/doinst.sh new file mode 100644 index 0000000000..070d1d8a5d --- /dev/null +++ b/network/apache2/doinst.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +copy_config() { + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +copy_config etc/rc.d/rc.httpd.new +copy_config etc/apache2/httpd.conf.new + +for conf_file in etc/apache2/extra/*.new; do + copy_config $conf_file +done diff --git a/network/apache2/logrotate.apache b/network/apache2/logrotate.apache new file mode 100644 index 0000000000..1f024ba345 --- /dev/null +++ b/network/apache2/logrotate.apache @@ -0,0 +1,9 @@ +/var/log/apache2/* { + size=100k + compress + rotate 5 + sharedscripts + postrotate + /etc/rc.d/rc.httpd restart + endscript +} diff --git a/network/apache2/patches/config.layout.patch b/network/apache2/patches/config.layout.patch new file mode 100644 index 0000000000..a227f786a6 --- /dev/null +++ b/network/apache2/patches/config.layout.patch @@ -0,0 +1,30 @@ +--- a/config.layout 2007-02-26 20:55:04.000000000 +0100 ++++ b/config.layout 2007-02-26 20:58:49.000000000 +0100 +@@ -322,3 +322,27 @@ + installbuilddir: ${prefix}/etc/apache2/build + errordir: ${datadir}/error + </Layout> ++ ++# FHS layout ++<Layout Slackware-FHS> ++ prefix: /usr ++ exec_prefix: ${prefix} ++ bindir: ${prefix}/bin ++ sbindir: ${prefix}/sbin ++ libdir: ${prefix}/lib/apache2 ++ libexecdir: ${prefix}/libexec/apache2 ++ installbuilddir: ${prefix}/libexec/apache2/build ++ mandir: ${prefix}/man ++ sysconfdir: /etc/apache2 ++ datadir: /var/www ++ iconsdir: ${datadir}/icons ++ htdocsdir: ${datadir}/htdocs ++ manualdir: ${htdocsdir}/manual ++ cgidir: ${datadir}/cgi-bin ++ errordir: ${datadir}/error ++ includedir: ${prefix}/include/apache2 ++ localstatedir: /var ++ runtimedir: ${localstatedir}/run/apache2 ++ logfiledir: ${localstatedir}/log/apache2 ++ proxycachedir: ${localstatedir}/cache/apache2 ++</Layout> diff --git a/network/apache2/patches/httpd.conf.diff b/network/apache2/patches/httpd.conf.diff new file mode 100644 index 0000000000..c506d8f94c --- /dev/null +++ b/network/apache2/patches/httpd.conf.diff @@ -0,0 +1,63 @@ +--- a/httpd.conf 2007-02-26 21:44:23.000000000 +0100 ++++ b/httpd.conf 2007-02-26 22:24:12.000000000 +0100 +@@ -88,7 +88,7 @@ + LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so + LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so + LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so +-LoadModule ssl_module libexec/apache2/mod_ssl.so ++#LoadModule ssl_module libexec/apache2/mod_ssl.so + LoadModule mime_module libexec/apache2/mod_mime.so + LoadModule dav_module libexec/apache2/mod_dav.so + LoadModule status_module libexec/apache2/mod_status.so +@@ -116,8 +116,8 @@ + # It is usually good practice to create a dedicated user and group for + # running httpd, as with most system services. + # +-User daemon +-Group daemon ++User apache2 ++Group apache2 + </IfModule> + + # 'Main' server configuration +@@ -419,34 +419,34 @@ + # necessary. + + # Server-pool management (MPM specific) +-#Include /etc/apache2/extra/httpd-mpm.conf ++Include /etc/apache2/extra/httpd-mpm.conf + + # Multi-language error messages + #Include /etc/apache2/extra/httpd-multilang-errordoc.conf + + # Fancy directory listings +-#Include /etc/apache2/extra/httpd-autoindex.conf ++Include /etc/apache2/extra/httpd-autoindex.conf + + # Language settings + #Include /etc/apache2/extra/httpd-languages.conf + + # User home directories +-#Include /etc/apache2/extra/httpd-userdir.conf ++Include /etc/apache2/extra/httpd-userdir.conf + + # Real-time info on requests and configuration +-#Include /etc/apache2/extra/httpd-info.conf ++Include /etc/apache2/extra/httpd-info.conf + + # Virtual hosts + #Include /etc/apache2/extra/httpd-vhosts.conf + + # Local access to the Apache HTTP Server Manual +-#Include /etc/apache2/extra/httpd-manual.conf ++Include /etc/apache2/extra/httpd-manual.conf + + # Distributed authoring and versioning (WebDAV) + #Include /etc/apache2/extra/httpd-dav.conf + + # Various default settings +-#Include /etc/apache2/extra/httpd-default.conf ++Include /etc/apache2/extra/httpd-default.conf + + # Secure (SSL/TLS) connections + #Include /etc/apache2/extra/httpd-ssl.conf diff --git a/network/apache2/patches/httpd_extra.diff b/network/apache2/patches/httpd_extra.diff new file mode 100644 index 0000000000..35f2f6bc00 --- /dev/null +++ b/network/apache2/patches/httpd_extra.diff @@ -0,0 +1,40 @@ +diff -aur a/extra/httpd-default.conf b/extra/httpd-default.conf +--- a/extra/httpd-default.conf 2007-01-21 21:19:30.000000000 +0100 ++++ b/extra/httpd-default.conf 2007-01-21 21:23:20.000000000 +0100 +@@ -52,7 +52,7 @@ + # Set to one of: Full | OS | Minor | Minimal | Major | Prod + # where Full conveys the most information, and Prod the least. + # +-ServerTokens Full ++ServerTokens Prod + + # + # Optionally add a line containing the server version and virtual host +@@ -62,7 +62,7 @@ + # Set to "EMail" to also include a mailto: link to the ServerAdmin. + # Set to one of: On | Off | EMail + # +-ServerSignature On ++ServerSignature Off + + # + # HostnameLookups: Log the names of clients or just their IP addresses +diff -aur a/extra/httpd-info.conf b/extra/httpd-info.conf +--- a/extra/httpd-info.conf 2007-01-21 21:19:30.000000000 +0100 ++++ b/extra/httpd-info.conf 2007-01-21 21:24:32.000000000 +0100 +@@ -14,7 +14,7 @@ + SetHandler server-status + Order deny,allow + Deny from all +- Allow from .example.com ++ Allow from localhost + </Location> + + # +@@ -33,5 +33,5 @@ + SetHandler server-info + Order deny,allow + Deny from all +- Allow from .example.com ++ Allow from localhost + </Location> diff --git a/network/apache2/rc.httpd b/network/apache2/rc.httpd new file mode 100644 index 0000000000..3be9b79143 --- /dev/null +++ b/network/apache2/rc.httpd @@ -0,0 +1,37 @@ +#!/bin/sh +# +# /etc/rc.d/rc.apache2 +# +# Start/stop/restart the Apache web server. +# +# To make Apache start automatically at boot, make this +# file executable: chmod 755 /etc/rc.d/rc.httpd2 +# + +APACHE_CTL=/usr/sbin/apachectl + +case "$1" in + 'start') + $APACHE_CTL -k start + ;; + + 'stop') + $APACHE_CTL -k stop + ;; + + 'graceful-stop') + $APACHE_CTL -k graceful + ;; + + 'restart') + $APACHE_CTL -k restart + ;; + + 'graceful-restart') + $APACHE_CTL -k graceful-restart + ;; + + *) + echo "Usage: $0 {start|stop|graceful-stop|restart|graceful-restart}" + ;; +esac diff --git a/network/apache2/slack-desc b/network/apache2/slack-desc new file mode 100644 index 0000000000..b694be62b9 --- /dev/null +++ b/network/apache2/slack-desc @@ -0,0 +1,12 @@ + |------handy-ruler------------------------------------------------------| +apache: apache2 +apache: +apache: Apache is the most popular web server in the known universe; over +apache: half of the servers on the Internet are running Apache or one of +apache: its variants. +apache: +apache: If you need FastCGI, we recommend an alternative FastCGI module: +apache: mod_fcgid. Visit http://fastcgi.coremail.cn for more info and +apache: http://slackbuilds.org for build script. +apache: +apache: Packaged by: Adis Nezirovic (nzx) <adis _at_ linux.org.ba> |