6 changed files with 330 additions and 0 deletions
@ -0,0 +1,27 @@
|
||||
#!/bin/sh |
||||
config() |
||||
{ |
||||
NEW="$1" |
||||
OLD="`dirname $NEW`/`basename $NEW .new`" |
||||
if [ ! -r $OLD ]; then |
||||
mv $NEW $OLD |
||||
elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then |
||||
rm $NEW |
||||
fi |
||||
} |
||||
|
||||
config etc/nginx/fastcgi.conf.new |
||||
config etc/nginx/fastcgi_params.new |
||||
config etc/nginx/koi-utf.new |
||||
config etc/nginx/koi-win.new |
||||
config etc/nginx/mime.types.new |
||||
config etc/nginx/nginx.conf.new |
||||
config etc/nginx/scgi_params.new |
||||
config etc/nginx/uwsgi_params.new |
||||
config etc/nginx/win-utf.new |
||||
|
||||
chown nobody var/log/nginx |
||||
chmod 0750 var/log/nginx |
||||
|
||||
chown nobody var/lib/nginx |
||||
chmod 0750 var/lib/nginx |
@ -0,0 +1 @@
|
||||
a99dc2ee4c60e3134891cd13c111f42901252c2b nginx-1.8.1.tar.gz |
@ -0,0 +1,182 @@
|
||||
#!/bin/bash |
||||
# Build script for Slackware |
||||
# Copyright (C) 2016 Damien Goutte-Gattat |
||||
# |
||||
# Copyright 2008 Cherife Le <cherife-#-dotimes.com> |
||||
# Copyright 2011 Diogo Leal <diogo@diogoleal.com> |
||||
# Copyright 2012-13 Francisco Ambrozio <sbo@franciscoambrozio.com> |
||||
# Copyright 2014-2015 Larry Hajali <larryhaja[at]gmail[dot]com> |
||||
# |
||||
# Redistribution and use of this script, with or without modifications, |
||||
# 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. |
||||
# |
||||
# Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org> |
||||
# |
||||
# Latest nginx sourcecode is available at: <http://nginx.org/> |
||||
|
||||
# Source package infos |
||||
NAMESRC=${NAMESRC:-nginx} |
||||
VERSION=${VERSION:-1.8.1} |
||||
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.gz} |
||||
WGET=${WGET:-http://nginx.org/download/$ARCHIVE} |
||||
|
||||
# Build infos |
||||
NAMEPKG=${NAMEPKG:-nginx} |
||||
BUILD=${BUILD:-1GGD} |
||||
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')} |
||||
JOBS=${JOBS:-1} |
||||
EXT=${EXT:-txz} |
||||
|
||||
# Directories |
||||
TMP=${TMP:-/tmp} |
||||
OUT=${OUT:-$TMP/build} |
||||
PKG=${PKG:-$OUT/$NAMEPKG} |
||||
CWD=$(pwd) |
||||
|
||||
set -e # Quit if a command returns non-zero |
||||
|
||||
# Sanity checks |
||||
if [ $UID -eq 0 ]; then |
||||
echo "You should NOT run this script as ROOT!" |
||||
exit 1 |
||||
fi |
||||
if [ ! -d $TMP ]; then |
||||
echo "$TMP does not exists or is not a directory!" |
||||
exit 1 |
||||
fi |
||||
|
||||
# Compilation flags |
||||
LIBDIRSUFFIX="" |
||||
case "$ARCH" in |
||||
i?86) |
||||
CPUOPT="-O2 -march=$ARCH -mtune=i686" |
||||
;; |
||||
x86_64) |
||||
CPUOPT="-O2 -fPIC" |
||||
LIBDIRSUFFIX="64" |
||||
;; |
||||
*) |
||||
CPUOPT="-O2" |
||||
;; |
||||
esac |
||||
|
||||
# Get and verify the source archive |
||||
if [ ! -r $ARCHIVE ]; then |
||||
wget -c -O $ARCHIVE.part "$WGET" |
||||
mv $ARCHIVE.part $ARCHIVE |
||||
fi |
||||
sha1sum -c $ARCHIVE.sha1 |
||||
NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1) |
||||
|
||||
# Compile |
||||
cd $TMP |
||||
echo "Building $ARCHIVE..." |
||||
tar xf $CWD/$ARCHIVE |
||||
cd $NAME |
||||
CFLAGS=$CPUOPT \ |
||||
CXXFLAGS=$CPUOPT \ |
||||
./configure \ |
||||
--prefix=/usr \ |
||||
--sbin-path=/usr/sbin/nginx \ |
||||
--conf-path=/etc/nginx/nginx.conf \ |
||||
--pid-path=/var/run/nginx.pid \ |
||||
--lock-path=/var/lock/subsys \ |
||||
--user=nobody \ |
||||
--group=nogroup \ |
||||
--error-log-path=/var/log/nginx/error.log \ |
||||
--http-log-path=/var/log/nginx/access.log \ |
||||
--http-client-body-temp-path=/var/lib/nginx/client_body \ |
||||
--http-proxy-temp-path=/var/lib/nginx/proxy \ |
||||
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ |
||||
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \ |
||||
--http-scgi-temp-path=/var/lib/nginx/scgi \ |
||||
--with-file-aio \ |
||||
--with-ipv6 \ |
||||
--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_image_filter_module \ |
||||
--with-http_sub_module \ |
||||
--with-http_dav_module \ |
||||
--with-http_flv_module \ |
||||
--with-http_mp4_module \ |
||||
--with-http_gunzip_module \ |
||||
--with-http_gzip_static_module \ |
||||
--with-http_random_index_module \ |
||||
--with-http_secure_link_module \ |
||||
--with-http_degradation_module \ |
||||
--with-http_stub_status_module \ |
||||
--with-http_auth_request_module \ |
||||
--with-mail \ |
||||
--with-mail_ssl_module \ |
||||
--with-http_spdy_module |
||||
make -j $JOBS |
||||
make install DESTDIR=$PKG |
||||
|
||||
# Strip binaries |
||||
find $PKG | xargs file | grep "ELF \(32\|64\)-bit LSB" | cut -d : -f 1 | \ |
||||
xargs strip --strip-unneeded 2> /dev/null |
||||
|
||||
# Install and compress man page |
||||
install -D -m 644 objs/nginx.8 $PKG/usr/man/man8/nginx.8 |
||||
gzip -9 $PKG/usr/man/man8/nginx.8 |
||||
|
||||
# Move html directory |
||||
mkdir -p $PKG/var/www |
||||
mv $PKG/usr/html $PKG/var/www |
||||
|
||||
# Create lib directory |
||||
mkdir -p $PKG/var/lib/nginx |
||||
|
||||
# Add init script |
||||
install -D -m 644 $CWD/rc.nginx $PKG/etc/rc.d/rc.nginx.new |
||||
|
||||
# Add logrotate file |
||||
install -D -m 644 $CWD/nginx.logrotate $PKG/etc/logrotate.d/nginx |
||||
|
||||
# Do not overwrite config files |
||||
for i in $(find $PKG/etc/nginx -type f ! -name "*\.default"); do |
||||
mv "$i" "$i.new" |
||||
done |
||||
|
||||
# Install the documentation |
||||
mkdir -p $PKG/usr/doc/$NAME |
||||
install -m 644 CHANGES LICENSE $PKG/usr/doc/$NAME |
||||
|
||||
# Copy slack-desc and doinst.sh files |
||||
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc |
||||
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh |
||||
|
||||
# Package the tree |
||||
cd $PKG |
||||
mkdir -p $OUT |
||||
PACKAGING=" |
||||
chown root:root . -R |
||||
/sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT |
||||
rm -rf $PKG |
||||
rm -rf $TMP/$NAME |
||||
" |
||||
if type -p fakeroot ; then |
||||
echo "$PACKAGING" | fakeroot |
||||
else |
||||
su -c "$PACKAGING" |
||||
fi |
@ -0,0 +1,12 @@
|
||||
/var/log/nginx/*.log { |
||||
su nobody nogroup |
||||
rotate 10 |
||||
notifempty |
||||
size=5M |
||||
compress |
||||
delaycompress |
||||
sharedscripts |
||||
postrotate |
||||
/etc/rc.d/rc.nginx rotate |
||||
endscript |
||||
} |
@ -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 |
@ -0,0 +1,12 @@
|
||||
|-----handy-ruler-----------------------------------------------------| |
||||
nginx: nginx (web and proxy server) |
||||
nginx: |
||||
nginx: Nginx is an HTTP and reverse proxy server, a mail proxy server, and |
||||
nginx: a generic TCP/UDP proxy server. |
||||
nginx: |
||||
nginx: |
||||
nginx: |
||||
nginx: |
||||
nginx: |
||||
nginx: |
||||
nginx: |
Loading…
Reference in new issue