network/openresty: Added (dynamic web platform).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
a9cca06f5f
commit
a65d559b98
|
@ -0,0 +1,40 @@
|
|||
openresty is a dynamic web platform based on NGINX and LuaJIT.
|
||||
|
||||
Install dependence packages
|
||||
slackpkg -batch=on -default_answer=y install zlib \
|
||||
gd libxslt fontconfig libxcb libX11 libXau libXdmcp libXpm
|
||||
|
||||
By default, openresty will use the "nobody" user and group accounts.
|
||||
You may specify alternate values on the command line if desired;
|
||||
for example:
|
||||
|
||||
OPENRESTYUSER=backup OPENRESTYGROUP=backup ./openresty.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 ./openresty.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 ./openresty.SlackBuild
|
||||
|
||||
Extra modules not included with stock openresty 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.openresty.org/3rdPartyModules.
|
||||
|
||||
ADDMODULE="/tmp/passenger-release-5.0.13/ext/openresty" \
|
||||
./openresty.SlackBuild
|
||||
|
||||
Using the optional dynamic loadable module support in openresty >=
|
||||
1.10.0. Understand that dynamic modules are a new feature in \
|
||||
openresty and issues may arise until further testing is done.
|
||||
|
||||
DYNAMIC=yes ./openresty.SlackBuild
|
|
@ -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.openresty.new
|
||||
config etc/logrotate.d/openresty.new
|
||||
config etc/openresty/fastcgi_params.new
|
||||
config etc/openresty/fastcgi.conf.new
|
||||
config etc/openresty/mime.types.new
|
||||
config etc/openresty/nginx.conf.new
|
||||
config etc/openresty/koi-utf.new
|
||||
config etc/openresty/koi-win.new
|
||||
config etc/openresty/scgi_params.new
|
||||
config etc/openresty/uwsgi_params.new
|
||||
config etc/openresty/win-utf.new
|
|
@ -0,0 +1,198 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Slackware build script for openresty
|
||||
|
||||
# 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>
|
||||
# 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
|
||||
|
||||
cd $(dirname $0) ; CWD=$(pwd)
|
||||
|
||||
PRGNAM=openresty
|
||||
VERSION=${VERSION:-1.21.4.3}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
i?86) ARCH=i586 ;;
|
||||
arm*) ARCH=arm ;;
|
||||
*) ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
|
||||
# the name of the created package would be, and then exit. This information
|
||||
# could be useful to other scripts.
|
||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
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="-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 -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 {} \;
|
||||
|
||||
CFLAGS="$SLKCFLAGS" \
|
||||
CXXFLAGS="$SLKCFLAGS" \
|
||||
./configure \
|
||||
--prefix=/opt/openresty \
|
||||
--conf-path=/etc/openresty/nginx.conf \
|
||||
--pid-path=/var/run/openresty.pid \
|
||||
--user=${NGINXUSER:=nobody} \
|
||||
--group=${NGINXGROUP:=nogroup} \
|
||||
--error-log-path=/var/log/openresty/error.log \
|
||||
--http-log-path=/var/log/openresty/access.log \
|
||||
--with-file-aio \
|
||||
--with-select_module \
|
||||
--with-poll_module \
|
||||
--with-threads \
|
||||
--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-pcre \
|
||||
--with-pcre-jit \
|
||||
--with-libatomic \
|
||||
$GEOIP_MOD \
|
||||
$GPERF_MOD \
|
||||
$ADD_MODULE
|
||||
|
||||
gmake
|
||||
gmake 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
|
||||
|
||||
mkdir -p $PKG/usr/man/man8
|
||||
install -m 0644 ./build/nginx-1.21.4/docs/man/nginx.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/opt/openresty/ -type d -empty -delete
|
||||
|
||||
find $PKG -perm 444 -exec chmod 0644 {} \;
|
||||
find $PKG -perm 555 -exec chmod 0755 {} \;
|
||||
|
||||
# Make the temp path.
|
||||
mkdir -p $PKG/var/lib/$PRGNAM
|
||||
chmod 0700 $PKG/var/lib/$PRGNAM
|
||||
chown $NGINXUSER $PKG/var/lib/$PRGNAM
|
||||
|
||||
# Move html directory
|
||||
#mkdir -p $PKG/var/www
|
||||
#mv $PKG/usr/html $PKG/var/www
|
||||
|
||||
# Add an init script
|
||||
mkdir -p $PKG/etc/rc.d
|
||||
cat $CWD/rc.openresty > $PKG/etc/rc.d/rc.openresty.new
|
||||
|
||||
mkdir -p $PKG/etc/logrotate.d
|
||||
sed -e "s,@USER@,$NGINXUSER," -e "s,@GROUP@,$NGINXGROUP," $CWD/openresty.logrotate \
|
||||
> $PKG/etc/logrotate.d/openresty.new
|
||||
|
||||
# Set the permissions for the log directory.
|
||||
chown $NGINXUSER $PKG/var/log/$PRGNAM
|
||||
chmod 750 $PKG/var/log/$PRGNAM
|
||||
|
||||
# Create sub-directory for virtual servers.
|
||||
mkdir $PKG/etc/$PRGNAM/conf.d
|
||||
|
||||
mkdir -p $PKG/usr/doc/openresty-$VERSION
|
||||
#cp -a CHANGES* LICENSE README $PKG/usr/doc/openresty-$VERSION
|
||||
cat $CWD/openresty.SlackBuild > $PKG/usr/doc/openresty-$VERSION/openresty.SlackBuild
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
||||
|
||||
install -m 0755 $PKG/opt/openresty/nginx/sbin/nginx /usr/bin/openresty
|
||||
|
||||
# Don't clobber config files
|
||||
for i in $(find $PKG/etc/$PRGNAM -type f ! -name "*\.default"); do
|
||||
mv "$i" "$i".new
|
||||
done
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="openresty"
|
||||
VERSION="1.21.4.3"
|
||||
HOMEPAGE="https://openresty.org/"
|
||||
DOWNLOAD="https://openresty.org/download/openresty-1.21.4.3.tar.gz"
|
||||
MD5SUM="9bb434e21a71d891b233fc1636186060"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES=""
|
||||
MAINTAINER="janshuez"
|
||||
EMAIL="janshuez[at]outlook[dot]com"
|
|
@ -0,0 +1,12 @@
|
|||
/var/log/openresty/*.log {
|
||||
su @USER@ @GROUP@
|
||||
rotate 10
|
||||
notifempty
|
||||
size 5M
|
||||
compress
|
||||
delaycompress
|
||||
sharedscripts
|
||||
postrotate
|
||||
/etc/rc.d/rc.openresty rotate
|
||||
endscript
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Openresty daemon control script.
|
||||
# Written for Slackware Linux by Cherife Li <cherife-#-dotimes.com>.
|
||||
|
||||
BIN=/usr/bin/openresty
|
||||
CONF=/etc/openresty/nginx.conf
|
||||
PID=/var/run/openresty.pid
|
||||
|
||||
openresty_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 "Openresty appears to already be running?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting Openresty server daemon..."
|
||||
if [ -x $BIN ]; then
|
||||
$BIN -c $CONF
|
||||
fi
|
||||
}
|
||||
|
||||
openresty_test_conf() {
|
||||
echo "Checking configuration for correct syntax and"
|
||||
echo "then trying to open files referenced in configuration..."
|
||||
$BIN -t -c $CONF
|
||||
}
|
||||
|
||||
openresty_term() {
|
||||
echo "Shutdown Openresty quickly..."
|
||||
kill -TERM $(cat $PID)
|
||||
}
|
||||
|
||||
openresty_stop() {
|
||||
echo "Shutdown Openresty gracefully..."
|
||||
kill -QUIT $(cat $PID)
|
||||
}
|
||||
|
||||
openresty_reload() {
|
||||
echo "Reloading Openresty configuration..."
|
||||
kill -HUP $(cat $PID)
|
||||
}
|
||||
|
||||
openresty_upgrade() {
|
||||
echo "Upgrading to the new Openresty binary."
|
||||
echo "Make sure the Openresty binary has been replaced with new one"
|
||||
echo "or Openresty server modules were added/removed."
|
||||
kill -USR2 $(cat $PID)
|
||||
sleep 3
|
||||
kill -QUIT $(cat $PID.oldbin)
|
||||
}
|
||||
|
||||
openresty_rotate() {
|
||||
echo "Rotating Openresty logs..."
|
||||
kill -USR1 $(cat $PID)
|
||||
}
|
||||
|
||||
openresty_restart() {
|
||||
openresty_stop
|
||||
sleep 3
|
||||
openresty_start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
check)
|
||||
openresty_test_conf
|
||||
;;
|
||||
start)
|
||||
openresty_start
|
||||
;;
|
||||
term)
|
||||
openresty_term
|
||||
;;
|
||||
stop)
|
||||
openresty_stop
|
||||
;;
|
||||
reload)
|
||||
openresty_reload
|
||||
;;
|
||||
restart)
|
||||
openresty_restart
|
||||
;;
|
||||
upgrade)
|
||||
openresty_upgrade
|
||||
;;
|
||||
rotate)
|
||||
openresty_rotate
|
||||
;;
|
||||
*)
|
||||
echo "usage: `basename $0` {check|start|term|stop|reload|restart|upgrade|rotate}"
|
||||
esac
|
|
@ -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------------------------------------------------------|
|
||||
openresty: openresty (a full-fledged web application server)
|
||||
openresty:
|
||||
openresty: bundling the standard nginx core.
|
||||
openresty: lots of 3rd-party nginx modules.
|
||||
openresty: as well as most of their external dependencies.
|
||||
openresty: as well as an IMAP/POP3 proxy server.
|
||||
openresty:
|
||||
openresty: Openresty is maintained by Yichun Zhang (agentzh).
|
||||
openresty: Nginx was written by Igor Sysoev.
|
||||
openresty: Homepage: https://openresty.org/
|
||||
openresty:
|
Loading…
Reference in New Issue