diff options
author | Max Miorim <miorimmax@gmail.com> | 2010-06-14 01:35:07 -0500 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-06-14 03:18:19 -0500 |
commit | 92c7ecbb2f68716e7003e1f4e87d3199775f40ed (patch) | |
tree | 0c56eb31e24035f2f8ca837f3e7b9d93012da4c7 | |
parent | be790d7cf8685474b215434e8a65a650a05e3e68 (diff) | |
download | slackbuilds-92c7ecbb2f68716e7003e1f4e87d3199775f40ed.tar.gz |
network/nginx: Added (http server and reverse proxy)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
-rw-r--r-- | network/nginx/0.7.65-fix_perl_man_path.patch | 12 | ||||
-rw-r--r-- | network/nginx/README | 10 | ||||
-rw-r--r-- | network/nginx/doinst.sh | 26 | ||||
-rw-r--r-- | network/nginx/nginx.SlackBuild | 158 | ||||
-rw-r--r-- | network/nginx/nginx.info | 10 | ||||
-rw-r--r-- | network/nginx/nginx.logrotate | 11 | ||||
-rw-r--r-- | network/nginx/rc.nginx | 96 | ||||
-rw-r--r-- | network/nginx/slack-desc | 19 |
8 files changed, 342 insertions, 0 deletions
diff --git a/network/nginx/0.7.65-fix_perl_man_path.patch b/network/nginx/0.7.65-fix_perl_man_path.patch new file mode 100644 index 0000000000..de54627363 --- /dev/null +++ b/network/nginx/0.7.65-fix_perl_man_path.patch @@ -0,0 +1,12 @@ +diff -Nru nginx-0.7.65.orig//auto/lib/perl/conf nginx-0.7.65/auto/lib/perl/conf +--- nginx-0.7.65.orig//auto/lib/perl/conf 2006-12-24 16:23:11.000000000 -0200 ++++ nginx-0.7.65/auto/lib/perl/conf 2010-06-07 00:42:23.398070172 -0300 +@@ -47,7 +47,7 @@ + if test -n "$NGX_PERL_MODULES"; then + have=NGX_PERL_MODULES value="(u_char *) \"$NGX_PERL_MODULES\"" + . auto/define +- NGX_PERL_MODULES_MAN=$NGX_PERL_MODULES/man3 ++ NGX_PERL_MODULES_MAN=/usr/man/man3 + fi + + else diff --git a/network/nginx/README b/network/nginx/README new file mode 100644 index 0000000000..e148206644 --- /dev/null +++ b/network/nginx/README @@ -0,0 +1,10 @@ +nginx [engine x] is a high-performance HTTP server and reverse proxy +as well as an IMAP/POP3 proxy server. + +By default, nginx will use the "nobody" user and group accounts. You may +specify alternate values on the command line if desired; for example: + + NGINXUSER=backup NGINXGROUP=backup ./nginx.SlackBuild + +Regardless of which user and group you decide to use, you will need to make +sure they exist on both the build system and the target system. diff --git a/network/nginx/doinst.sh b/network/nginx/doinst.sh new file mode 100644 index 0000000000..c4aaf4f4ff --- /dev/null +++ b/network/nginx/doinst.sh @@ -0,0 +1,26 @@ +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... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname ${NEW})/$(basename ${NEW} .new)" + if [ -e ${OLD} ]; then + cp -a ${OLD} ${NEW}.incoming + cat ${NEW} > ${NEW}.incoming + mv ${NEW}.incoming ${NEW} + fi + config ${NEW} +} + +preserve_perms etc/rc.d/rc.nginx.new +config etc/logrotate.d/nginx.new diff --git a/network/nginx/nginx.SlackBuild b/network/nginx/nginx.SlackBuild new file mode 100644 index 0000000000..397a0d2bc2 --- /dev/null +++ b/network/nginx/nginx.SlackBuild @@ -0,0 +1,158 @@ +#!/bin/sh +# +# Slackware build script for nginx +# +# Copyright 2008 Cherife Li <cherife-#-dotimes.com> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Modified by Max Miorim <miorimmax@gmail.com> + +PRGNAM=nginx +VERSION=${VERSION:-0.7.65} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; +# Unless $ARCH is already set, use uname -m for all other archs: + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +eval $(perl '-V:installvendorlib') + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# patch to install the perl man pages in /usr/man/man3 +patch -p1 --verbose < $CWD/0.7.65-fix_perl_man_path.patch + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sbin-path=/usr/sbin/nginx \ + --conf-path=/etc/nginx/nginx.conf \ + --pid-path=/var/run/nginx.pid \ + --lock-path=/var/lock/nginx \ + --user=${NGINXUSER:-nobody} \ + --group=${NGINXGROUP:-nogroup} \ + --error-log-path=/var/log/nginx/error.log \ + --http-log-path=/var/log/nginx/access.log \ + --with-rtsig_module \ + --with-select_module \ + --with-poll_module \ + --with-http_ssl_module \ + --with-http_realip_module \ + --with-http_addition_module \ + --with-http_xslt_module \ + --with-http_sub_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_gzip_static_module \ + --with-http_random_index_module \ + --with-http_secure_link_module \ + --with-http_stub_status_module \ + --with-http_perl_module \ + --with-perl_modules_path=$installvendorlib \ + --http-client-body-temp-path=/var/tmp/nginx_client_body_temp \ + --http-proxy-temp-path=/var/tmp/nginx_proxy_temp \ + --http-fastcgi-temp-path=/dev/shm \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module + +make +make install DESTDIR=$PKG + +find $PKG | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true +find $PKG | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true +find $PKG -name perllocal.pod -o -name ".packlist" -o -name "*.bs" | \ + xargs rm -f 2> /dev/null +find $PKG -perm 444 -exec chmod 0644 {} \; +find $PKG -perm 555 -exec chmod 0755 {} \; + +find $PKG/usr/man -type f -exec gzip -9 {} \; + +# Remove some other empty and/or unnecessary directories from the package +eval $(perl '-V:archlib') +rm -rf $PKG/$archlib $PKG/usr/html $PKG/var + +# Add an init script +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.nginx > $PKG/etc/rc.d/rc.nginx.new + +mkdir -p $PKG/etc/logrotate.d +cat $CWD/nginx.logrotate > $PKG/etc/logrotate.d/nginx.new + +mkdir -p $PKG/usr/doc/nginx-$VERSION +cp -a CHANGES CHANGES.ru LICENSE README $PKG/usr/doc/nginx-$VERSION +cat $CWD/nginx.SlackBuild > $PKG/usr/doc/nginx-$VERSION/nginx.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +# Let's not clobber config files on upgrade +( cd $PKG/etc/nginx + for i in fastcgi_params mime.types nginx.conf koi-utf koi-win win-utf; do + mv $i $i.new; + echo "config etc/nginx/$i.new" >> $PKG/install/doinst.sh; + done +) + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/nginx/nginx.info b/network/nginx/nginx.info new file mode 100644 index 0000000000..5e3175ac5e --- /dev/null +++ b/network/nginx/nginx.info @@ -0,0 +1,10 @@ +PRGNAM="nginx" +VERSION="0.7.65" +HOMEPAGE="http://nginx.org/" +DOWNLOAD="http://nginx.org/download/nginx-0.7.65.tar.gz" +MD5SUM="abc4f76af450eedeb063158bd963feaa" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Max Miorim" +EMAIL="miorimmax@gmail.com" +APPROVED="rworkman" diff --git a/network/nginx/nginx.logrotate b/network/nginx/nginx.logrotate new file mode 100644 index 0000000000..d95c808449 --- /dev/null +++ b/network/nginx/nginx.logrotate @@ -0,0 +1,11 @@ +/var/log/nginx/*_log { + rotate 10 + notifempty + size=5M + compress + delaycompress + sharedscripts + postrotate + /etc/rc.d/rc.nginx rotate + endscript +} diff --git a/network/nginx/rc.nginx b/network/nginx/rc.nginx new file mode 100644 index 0000000000..f9f377695f --- /dev/null +++ b/network/nginx/rc.nginx @@ -0,0 +1,96 @@ +#!/bin/sh +# +# Nginx daemon control script. +# Written for Slackware Linux by Cherife Li <cherife-#-dotimes.com>. + +BIN=/usr/sbin/nginx +CONF=/etc/nginx/nginx.conf +PID=/var/run/nginx.pid + +nginx_start() { + # Sanity checks. + if [ ! -r $CONF ]; then # no config file, exit: + echo "$CONF does not appear to exist. Abort." + exit 1 + fi + + if [ -s $PID ]; then + echo "Nginx appears to already be running?" + exit 1 + fi + + echo "Starting Nginx server daemon..." + if [ -x $BIN ]; then + $BIN -c $CONF + fi +} + +nginx_test_conf() { + echo "Checking configuration for correct syntax and" + echo "then trying to open files referenced in configuration..." + $BIN -t -c $CONF +} + +nginx_term() { + echo "Shutdown Nginx quickly..." + kill -TERM $(cat $PID) +} + +nginx_stop() { + echo "Shutdown Nginx gracefully..." + kill -QUIT $(cat $PID) +} + +nginx_reload() { + echo "Reloading Nginx configuration..." + kill -HUP $(cat $PID) +} + +nginx_upgrade() { + echo "Upgrading to the new Nginx binary." + echo "Make sure the Nginx binary has been replaced with new one" + echo "or Nginx server modules were added/removed." + kill -USR2 $(cat $PID) + sleep 3 + kill -QUIT $(cat $PID.oldbin) +} + +nginx_rotate() { + echo "Rotating Nginx logs..." + kill -USR1 $(cat $PID) +} + +nginx_restart() { + nginx_stop + sleep 3 + nginx_start +} + +case "$1" in + check) + nginx_test_conf + ;; + start) + nginx_start + ;; + term) + nginx_term + ;; + stop) + nginx_stop + ;; + reload) + nginx_reload + ;; + restart) + nginx_restart + ;; + upgrade) + nginx_upgrade + ;; + rotate) + nginx_rotate + ;; + *) + echo "usage: `basename $0` {check|start|term|stop|reload|restart|upgrade|rotate}" +esac diff --git a/network/nginx/slack-desc b/network/nginx/slack-desc new file mode 100644 index 0000000000..b7b1a62e39 --- /dev/null +++ b/network/nginx/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +nginx: nginx (http/imap/pop3 proxy) +nginx: +nginx: Nginx [engine x] is a high-performance HTTP server and reverse proxy, +nginx: as well as an IMAP/POP3 proxy server. +nginx: +nginx: Nginx was written by Igor Sysoev. +nginx: +nginx: Homepage: http://nginx.net/ +nginx: +nginx: +nginx: |