0

Initial commit

This commit is contained in:
eleksir
2023-11-19 18:01:40 +03:00
commit 80ec8a7529
586 changed files with 29486 additions and 0 deletions

34
nginx/README Normal file
View File

@@ -0,0 +1,34 @@
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.
Geoip support is now available as an option using the GeopIP package. If you wish
to enable GeoIP the pass GEOIP variable to the slackbuild:
GEOIP=yes ./nginx.SlackBuild
Support for gperftools is available as an option using the gperftools package.
If you wish to enable gperftools pass the GPERF variable to the slackbuild:
GPERF=yes ./nginx.SlackBuild
Extra modules not included with stock nginx can be added by passing them as a
variable to the slackbuild as a space separated list of full paths to modules.
List of extra 3rd party modules available at http://wiki.nginx.org/3rdPartyModules.
ADDMODULE="/tmp/passenger-release-5.0.13/ext/nginx" ./nginx.SlackBuild
Using the optional dynamic loadable module support in nginx >= 1.10.0. Understand
that dynamic modules are a new feature in nginx and issues may arise until further
testing is done.
DYNAMIC=yes ./nginx.SlackBuild
Optional dependency: libwebp (requires gd to be recompiled)

35
nginx/doinst.sh Normal file
View File

@@ -0,0 +1,35 @@
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
config etc/nginx/fastcgi_params.new
config etc/nginx/fastcgi.conf.new
config etc/nginx/mime.types.new
config etc/nginx/nginx.conf.new
config etc/nginx/koi-utf.new
config etc/nginx/koi-win.new
config etc/nginx/scgi_params.new
config etc/nginx/uwsgi_params.new
config etc/nginx/win-utf.new

250
nginx/nginx.SlackBuild Executable file
View File

@@ -0,0 +1,250 @@
#!/bin/bash -ex
# Slackware build script for nginx
# Copyright 2008 Cherife Li <cherife-#-dotimes.com>
# Copyright 2011 Diogo Leal <diogo@diogoleal.com>
# Copyright 2012-13 Francisco Ambrozio <sbo@franciscoambrozio.com>
# Copyright 2014-2017 Larry Hajali <larryhaja[at]gmail[dot]com>
# Copyright 2023 Sergei Fedosoff <eleksir@gmail.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.
# Special thanks to Thomas Morper for some configuration adjustments tips
PRGNAM=nginx
VERSION=${VERSION:-1.24.0}
BUILD=${BUILD:-2}
TAG=${TAG:-_EXs}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/EXs}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-g -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 xf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \+ -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
# Remove -Werror from CFLAGS.
# https://trac.nginx.org/nginx/ticket/1259
sed -i '/-Werror/d' auto/cc/gcc
# Fix the nginx.conf file for html and virtual server directory.
sed -i \
-e '/root[ ]*html/s|html;|/var/www/&|' \
-e '$s|.*| include /etc/nginx/conf.d/\*.conf;\n&|' conf/$PRGNAM.conf
# Add if dynamic modules are used.
if [ "${DYNAMIC:-no}" == "yes" ]; then
DYNAMIC_MODULE=${DYNAMIC_MODULE:-=dynamic}
sed -i 's|^events.*|include /etc/nginx/modules/\*.conf;\n\n&|' conf/$PRGNAM.conf
else
DYNAMIC_MODULE=""
fi
# Enable GeoIP support.
if [ "${GEOIP:-yes}" == "yes" ]; then
GEOIP_MOD="--with-http_geoip_module${DYNAMIC_MODULE}
--with-stream_geoip_module${DYNAMIC_MODULE}"
else
GEOIP_MOD=""
fi
# Add extra modules not included in nginx.
ADDMODULE=${ADDMODULE:-}
if [ "$DYNAMIC" == "yes" ]; then
ADD_MODULE="--add-dynamic-module=$ADDMODULE
--modules-path=/usr/lib${LIBDIRSUFFIX}/$PRGNAM/modules"
else
ADD_MODULE="--add-module=$ADDMODULE"
fi
# Enable gperftools support.
if [ "${GPERF:-no}" == "yes" ]; then
GPERF_MOD="--with-google_perftools_module"
else
GPERF_MOD=""
fi
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
LDFLAGS="-flto -rdynamic -Wl,--export-dynamic -Wl,-O2 -Wl,-E -Wl,--no-as-needed" \
./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/run/nginx.pid \
--lock-path=/var/lock/subsys \
--user=apache \
--group=apache \
--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-select_module \
--with-poll_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module${DYNAMIC_MODULE} \
--with-http_image_filter_module${DYNAMIC_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_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_perl_module${DYNAMIC_MODULE} \
--with-mail${DYNAMIC_MODULE} \
--with-mail_ssl_module \
--with-stream${DYNAMIC_MODULE} \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_ssl_preread_module \
--with-cpp_test_module \
--with-compat \
--with-debug \
--with-pcre \
--with-pcre-jit \
--with-libatomic \
$GEOIP_MOD \
$GPERF_MOD \
$ADD_MODULE
make -j$(nproc)
make -j$(nproc) install \
DESTDIR=$PKG \
INSTALLDIRS=vendor \
INSTALLVENDORMAN3DIR=/usr/man/man3
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
install -Dpm 0644 objs/$PRGNAM.8 $PKG/usr/man/man8
find $PKG/usr/man -type f -exec gzip -9 {} \+
find $PKG -name perllocal.pod \
-o -name ".packlist" \
-o -name "*.bs" \
| xargs rm -f {}
find $PKG -perm 444 -exec chmod 0644 {} \+
find $PKG -perm 555 -exec chmod 0755 {} \+
# Make the temp path.
install -dm 0755 -o apache -g apache $PKG/var/lib/$PRGNAM
# Move html directory
mkdir -p $PKG/var/www
mv $PKG/usr/html $PKG/var/www
# Add an init script
install -Dpm 0644 $CWD/rc.nginx $PKG/etc/rc.d/rc.nginx.new
install -Dpm 0644 $CWD/nginx.logrotate $PKG/etc/logrotate.d/nginx.new
# Set the permissions for the log directory.
install -dm 0755 -o apache $PKG/var/log/$PRGNAM
# Create sub-directory for virtual servers.
install -dm 0755 $PKG/etc/$PRGNAM/conf.d
install -Dpm 0644 $CWD/nginx.SlackBuild $PKG/usr/doc/nginx-$VERSION/nginx.SlackBuild
cp -a CHANGES* LICENSE README $PKG/usr/doc/nginx-$VERSION
install -Dpm 0644 $CWD/slack-desc $PKG/install/slack-desc
install -Dpm 0644 $CWD/slack-required $PKG/install/slack-required
install -Dpm 0644 $CWD/doinst.sh $PKG/install/doinst.sh
# Create modules directory and config files.
# Unfortunately, we have to use full paths rather then relative paths
# for nginx dynamic modules, or else we get the following error:
# $ sudo /usr/sbin/nginx -t
# nginx: [emerg] dlopen() "/usr/modules/ngx_stream_module.so" failed (/usr/modules/ngx_stream_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/modules/mod-stream.conf:1
# nginx: configuration file /etc/nginx/nginx.conf test failed
# Source: https://trac.nginx.org/nginx/ticket/961
if [ "$DYNAMIC" == "yes" ]; then
mkdir $PKG/etc/$PRGNAM/modules
for module in $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/modules/*; do
MODULE_NAME=$(basename $module | sed 's|\.so||' | tr _ -)
MODULE_DIR=$(dirname $module | sed "s|$PKG||")
echo "load_module \"${MODULE_DIR}/$(basename $module)\";" > \
$PKG/etc/$PRGNAM/modules/${MODULE_NAME}.conf
echo "config etc/$PRGNAM/modules/${MODULE_NAME}.conf.new" >> $PKG/install/doinst.sh
done
fi
# Don't clobber config files
for i in $(find $PKG/etc/$PRGNAM -type f ! -name "*\.default"); do
mv "$i" "$i".new
done
# Fixup user
sed 's/^.user *nobody/user apache/' $PKG/etc/nginx/nginx.conf.new
sed 's/^.user *nobody/user apache/' $PKG/etc/nginx/nginx.conf.default
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

11
nginx/nginx.info Normal file
View File

@@ -0,0 +1,11 @@
PRGNAM="nginx"
VERSION="1.24.0"
HOMEPAGE="http://nginx.org/"
DOWNLOAD="http://nginx.org/download/nginx-1.24.0.tar.gz"
MD5SUM=""
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
BUILDREQUIRES="GeoIP"
REQUIRES="GeoIP"
MAINTAINER="Larry Hajali"
EMAIL="larryhaja[at]gmail[dot]com"

13
nginx/nginx.logrotate Normal file
View File

@@ -0,0 +1,13 @@
/var/log/nginx/*.log {
su apache apache
daily
nodateext
rotate 4
notifempty
compress
delaycompress
sharedscripts
postrotate
/etc/rc.d/rc.nginx rotate
endscript
}

132
nginx/rc.nginx Normal file
View File

@@ -0,0 +1,132 @@
#!/bin/sh
#
# Nginx daemon control script.
# Written for Slackware Linux by Cherife Li <cherife-#-dotimes.com>.
# Updated by Sergei Fedosoff <eleksir@gmail.com>
BIN=/usr/sbin/nginx
CONF=/etc/nginx/nginx.conf
PID=/run/nginx.pid
LOGDIR=/var/log/nginx
VARDIR=/var/lib/nginx
USER=apache
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
if [ -d $LOGDIR ]; then
chmod -R $USER $LOGDIR
else
install -dm 0755 -o $USER $LOGDIR
fi
if [ -d $VARDIR ]; then
chown -R $USER $VARDIR
else
install -dm 0755 -o $USER $VARDIR
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..."
if [ -x $BIN ]; then
$BIN -s quit
else
kill -QUIT $(cat $PID) 2 >/dev/null
fi
}
nginx_reload() {
echo "Reloading Nginx configuration..."
if [ -x $BIN ]; then
$BIN -s reload
else
kill -HUP $(cat $PID)
fi
}
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..."
if [ -x $BIN ]; then
$BIN -s reopen
else
kill -USR1 $(cat $PID)
fi
}
nginx_restart() {
nginx_stop
for i in 1 2 3; do
if [ -e $PID ]; then
/usr/bin/echo -n "."
sleep 1
else
break
fi
done
echo
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

19
nginx/slack-desc Normal file
View File

@@ -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 ':' except on otherwise blank lines.
|-----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:

1
nginx/slack-required Normal file
View File

@@ -0,0 +1 @@
GeoIP