1
0
Fork 0

added script files

This commit is contained in:
Sangbum Kim 2016-03-01 02:04:18 +09:00
parent 6a731caddd
commit b3c086c60d
5 changed files with 330 additions and 0 deletions

227
PKGBUILD Normal file
View File

@ -0,0 +1,227 @@
# Maintainer: Alexander Kuznecov <alexander@kuznetcov.me>
_pkgname="nginx"
_user="http"
_group="http"
_doc_root="/usr/share/${_pkgname}/html"
_sysconf_path="etc"
_conf_path="${_sysconf_path}/${_pkgname}"
_tmp_path="/var/spool/${_pkgname}"
_pid_path="/run"
_lock_path="/var/lock"
_log_path="/var/log/${_pkgname}"
### 3d party modules:
_libre_ver="2.3.2"
_libre_dirname="ngx_libressl"
_cachepurge_ver="2.3"
_cachepurge_dirname="ngx_cachepurge"
_slowfscache_ver="1.10"
_slowfscache_dirname="ngx_slowfscache"
_echo_ver="v0.58"
_echo_dirname="ngx_echo"
_headersmore_ver="v0.29"
_headersmore_dirname="ngx_headersmore"
_uploadprogress_ver="v0.9.1"
_uploadprogress_dirname="ngx_uploadprogress"
_upstreamfair_hash="a18b4099fbd458111983200e098b6f0c8efed4bc"
_upstreamfair_dirname="ngx_upstreamfair"
_fancyindex_ver="v0.3.5"
_fancyindex_dirname="ngx_fancyindex"
_authpam_ver="1.4"
_authpam_dirname="ngx_authpam"
_pagespeed_ver="1.10.33.5"
_pagespeed_dirname="ngx_pagespeed"
_rtmp_ver="v1.1.7"
_rtmp_dirname="ngx_rtmp"
_davext_ver="v0.0.3"
_davext_dirname="ngx_davext"
_naxsi_ver="0.54"
_naxsi_dirname="ngx_naxsi"
_accesskey_ver="2.0.3"
_accesskey_dirname="ngx_accesskey"
pkgname=nginx-spica
pkgver=1.9.11
pkgrel=1
pkgdesc="Development version of lightweight HTTP server and IMAP/POP3 proxy server with standard, additional and 3d party modules"
arch=('i686' 'x86_64')
depends=('pcre' 'zlib' 'openssl' 'pam' 'gperftools' 'libatomic_ops' 'hardening-wrapper' 'geoip' 'geoip-database' 'gd' 'libxslt')
makedepends=(
'libxslt'
'gd'
'git'
)
url="http://nginx.org"
license=('custom')
conflicts=('nginx' 'nginx-libressl' 'nginx-unstable' 'nginx-svn' 'nginx-devel' 'nginx-custom' 'nginx-full')
provides=('nginx')
backup=("${_conf_path}/nginx.conf"
"${_conf_path}/koi-win"
"${_conf_path}/koi-utf"
"${_conf_path}/win-utf"
"${_conf_path}/mime.types"
"${_conf_path}/fastcgi.conf"
"${_conf_path}/fastcgi_params"
"${_conf_path}/scgi_params"
"${_conf_path}/uwsgi_params"
"etc/logrotate.d/nginx")
_user=http
_group=http
source=("nginx.sh"
"nginx.conf"
"nginx.logrotate"
"nginx.service"
"http://nginx.org/download/nginx-$pkgver.tar.gz"
"${_fancyindex_dirname}.tar.gz::https://github.com/aperezdc/ngx-fancyindex/archive/${_fancyindex_ver}.tar.gz"
"${_cachepurge_dirname}.tar.gz::http://labs.frickle.com/files/ngx_cache_purge-${_cachepurge_ver}.tar.gz"
"${_slowfscache_dirname}.tar.gz::http://labs.frickle.com/files/ngx_slowfs_cache-${_slowfscache_ver}.tar.gz"
"${_uploadprogress_dirname}.source::https://github.com/masterzen/nginx-upload-progress-module/tarball/${_uploadprogress_ver}"
"${_headersmore_dirname}.source::https://github.com/agentzh/headers-more-nginx-module/tarball/${_headersmore_ver}"
"${_echo_dirname}.source::https://github.com/agentzh/echo-nginx-module/tarball/${_echo_ver}"
"${_upstreamfair_dirname}.source::https://github.com/gnosek/nginx-upstream-fair/tarball/${_upstreamfair_hash}"
"${_authpam_dirname}.tar.gz::https://github.com/stogh/ngx_http_auth_pam_module/archive/v${_authpam_ver}.tar.gz"
"${_pagespeed_dirname}.zip::https://github.com/pagespeed/ngx_pagespeed/archive/v${_pagespeed_ver}-beta.zip"
"psol.tar.gz::https://dl.google.com/dl/page-speed/psol/${_pagespeed_ver}.tar.gz"
"${_rtmp_dirname}.zip::https://github.com/arut/nginx-rtmp-module/archive/${_rtmp_ver}.zip"
"${_davext_dirname}.tar.gz::https://github.com/arut/nginx-dav-ext-module/archive/${_davext_ver}.tar.gz"
"${_naxsi_dirname}.tar.gz::https://github.com/nbs-system/naxsi/archive/${_naxsi_ver}.tar.gz"
"${_accesskey_dirname}.tar.gz::https://ostube.googlecode.com/files/Nginx-accesskey-${_accesskey_ver}.tar.gz"
"${_libre_dirname}-${_libre_ver}.tar.gz::http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${_libre_ver}.tar.gz"
)
sha512sums=('a396d52457d22fb68cf5abe3faa09cca97d31b9b354b2e44ce6af02d695e2eb790093cf28c68db0c017b1194d46212a98042d297a1d5929fd5c5b8a1ed5f4bd3'
'0ea04699103f775305f2f19bcf111eca9dfe75d3372ab2e3f487efed21a6d6eb7a95504eeb832ea5fb10feaaf97566e7764f04def5bbd167b09a0e7f54735304'
'953f898fb3f5347dd39c9ad6397c15365ca3450308f969d7f4f1d62728c1c05d20bacecd4b77e43e83d8afb57c62632bce6b1e54a1960529ae0cc2026ffcb58a'
'ee22b310e0ac511d91b7b1925c61935e3513f6a5966bfad2e331eec1c0f0aaa725f79524e99f153a61f75cf3067ee07e7c57b8fa80196ed4c8d47cdcb0b4e69d'
'1ea79b8ade066faa4facdb13631b97c3228cc91f512dc98c7b1b153a489936f2bc13017ea67097cd303581720fd9bc3a212744ac0a03a1ea514e56321b407caa'
'ddb4ab3e8e47e1c49680db3e9f648f7cd582c07f963204105118e61432fa1e80c3f1bce69ed689db383011a9c155184bcc7e931eeae20bbd7cbdb5d4eb35a0a8'
'50a31dbf2216a6fae74a186af56dec4600cf55777e76a10ac0075f609e7737135aab063a64f2590dddcd0369ebebd4a523027f3d9ebcca74f7b4355be1c5dcc0'
'fbc9609a8d6913aeefe535f206b9e53477503f131934ead2ae5a6169e395af2f5fb54778704824d5eeb22a4ef40a11ebbcde580db62a631f70edcc2cfc06b15d'
'44d5a1065b661d8e17557e97e1b2af173f7005f2b9625ae472cde783d6157f10940e2899073843231d8cbcf0272dd1d9bda14e097249d3d9a7c6e33500e9f4b9'
'983afb29ffa9d036cae47bf6b79c1b6525ec4ceacfc07992068e27086e8999d73447a27a8161570c8d8c411fcac0994c034c1268c1ddb627d421a78f47990cd2'
'28a62ad523edf44d3ba137b64cba60c9a69239ed1badfcbfe4817afa31b7b6d1de28092492bccf42ec8f4d7dae75f2437b4990329b48c1d3ce67da6139e142e2'
'843f2037fca792a215daf3ab33ca5bb1ffc159a0bfb3f54f1d7c5e992ec394bc5d41a01f01b4a9ede02bab795b1d1f8f06dc88ae1a1d60480fc10a5cfc51a6a1'
'8d60347c666736ef39161b287ad32820ad6be4695f1c0f27a000d46bfc7e26c95233247d39cf37296518a6329ba73f06756d0b0b68157b0e5f67796f73264db3'
'ee0f98720dea83590f378281de1e3996e16675a5625c6cf33dce9e0a84a39625256be922ed8e87c4501882c3cda5bbc4e1789ac0ffd8d079de0e03fd713656ae'
'd160796a18cd1fb59453907e3ea561b5077a9aee92273b6e595fc2c7b1674deead951697bef12f79380caf3807616ca0de2fd891f391c9289d748d5706799cb8'
'9a67f81e305dfbfe148a729b84be2ad21016022d72d315b3506e7cc0907e47231e51011205f70484bc65e83e064de2c4c4d70e20ae141e0f03551c6e9ced10ce'
'4763b1c5e417248d80acfacf20bfc5ba3e06675ff08e37703867daef99a400980b536941e4955c259432905bd11ab998bc2e2489a50350413c7bf37e18eafb74'
'91934bfd41495715269cc6e549d17f6da66f2bdd0c9a6821fa9096b694dd3927109c4aad2f8b327620ae7c34f76a0839ac16669cd8c65081bc01fa7f829c1d43'
'f6d5e0ce14ca7f98b2a8641d312e86cf3530eda9f28592c38f950a4cfac519fbad9b5850d24a8a59ae78424e5e6420664cce6bd069544ee9984e8a034fd698ec'
'619acf3e9c670cc5f32aa9e0064e8b72297bfc05c68743c5cb9f7b7332207d05fc43f44ea9652db9b651b301e8ce5dd90777a20a4a25e8145d1f7fa977d782c1')
build() {
local _src_dir="${srcdir}/${_pkgname}-${pkgver}"
mv libressl-* ${_libre_dirname}
mv ngx-fancyindex-* ${_fancyindex_dirname}
mv ngx_cache_purge-* ${_cachepurge_dirname}
mv ngx_slowfs_cache-* ${_slowfscache_dirname}
mv openresty-headers-more-nginx-module-* ${_headersmore_dirname}
mv openresty-echo-nginx-module-* ${_echo_dirname}
mv masterzen-nginx-upload-progress-module-* ${_uploadprogress_dirname}
mv gnosek-nginx-upstream-fair-* ${_upstreamfair_dirname}
mv ngx_http_auth_pam_module-${_authpam_ver} ${_authpam_dirname}
mv ngx_pagespeed-* ${_pagespeed_dirname}
mv psol ${_pagespeed_dirname}/
mv nginx-rtmp-module* ${_rtmp_dirname}
mv nginx-dav-ext-module* ${_davext_dirname}
mv naxsi* ${_naxsi_dirname}
mv nginx-accesskey* ${_accesskey_dirname}
cd $_src_dir
./configure \
--prefix="/${_conf_path}" \
--conf-path="/${_conf_path}/nginx.conf" \
--sbin-path="/usr/bin/${_pkgname}" \
--pid-path="${_pid_path}/${_pkgname}.pid" \
--lock-path=${_pid_path}/${_pkgname}.lock \
--http-client-body-temp-path=${_tmp_path}/client_body_temp \
--http-proxy-temp-path=${_tmp_path}/proxy_temp \
--http-fastcgi-temp-path=${_tmp_path}/fastcgi_temp \
--http-uwsgi-temp-path=${_tmp_path}/uwsgi_temp \
--http-scgi-temp-path=${_tmp_path}scgi_temp \
--http-log-path=${_log_path}/access.log \
--error-log-path=${_log_path}/error.log \
--user=${_user} \
--group=${_group} \
--with-ipv6 \
--with-openssl=../${_libre_dirname}/ \
--add-module=../${_naxsi_dirname}/naxsi_src/ \
--with-threads \
--with-stream \
--with-pcre-jit \
--with-file-aio \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_dav_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_sub_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_perl_module \
--with-http_degradation_module \
--with-http_geoip_module \
--with-http_v2_module \
--with-http_gunzip_module \
--with-http_auth_request_module \
--with-libatomic \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
--with-stream_ssl_module \
--with-google_perftools_module \
--add-module=../${_cachepurge_dirname} \
--add-module=../${_echo_dirname} \
--add-module=../${_headersmore_dirname} \
--add-module=../${_slowfscache_dirname} \
--add-module=../${_uploadprogress_dirname} \
--add-module=../${_upstreamfair_dirname} \
--add-module=../${_fancyindex_dirname} \
--add-module=../${_authpam_dirname} \
--add-module=../${_pagespeed_dirname} \
--add-module=../${_rtmp_dirname} \
--add-module=../${_davext_dirname} \
--add-module=../${_accesskey_dirname}
make -j8
}
package() {
cd "${srcdir}/${_pkgname}-${pkgver}"
make DESTDIR="$pkgdir/" install
sed -e "s|\<user\s\+\w\+;|user $_user $_group;|g" \
-e '44s|html|/usr/share/nginx/html|' \
-e '54s|html|/usr/share/nginx/html|' \
-i ${pkgdir}/$_conf_path/nginx.conf
mkdir -p ${pkgdir}/$_conf_path/sites-enabled/
mkdir -p ${pkgdir}/$_conf_path/sites-available/
install -d "${pkgdir}/${_tmp_path}"
install -d "${pkgdir}/${_doc_root}"
mv "${pkgdir}/${_conf_path}/html/"* "${pkgdir}/${_doc_root}"
rm -rf "${pkgdir}/${_conf_path}/html"
install -D -m555 "${srcdir}/nginx.sh" "${pkgdir}/etc/rc.d/${_pkgname}"
install -D -m644 "${srcdir}/nginx.logrotate" "${pkgdir}/etc/logrotate.d/${_pkgname}"
install -D -m644 "${srcdir}/nginx.conf" "${pkgdir}/etc/conf.d/${_pkgname}"
install -D -m644 "${srcdir}/nginx.service" "${pkgdir}/usr/lib/systemd/system/nginx.service"
install -D -m644 "LICENSE" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
install -D -m644 "man/nginx.8" "${pkgdir}/usr/share/man/man8/nginx.8"
}

1
nginx.conf Normal file
View File

@ -0,0 +1 @@
NGINX_CONFIG=/etc/nginx/nginx.conf

11
nginx.logrotate Normal file
View File

@ -0,0 +1,11 @@
/var/log/nginx/*log
/var/log/nginx/*/*log
{
daily
missingok
create 640 http log
compress
postrotate
[ ! -f /run/nginx.pid ] || kill -USR1 `cat /run/nginx.pid`
endscript
}

18
nginx.service Normal file
View File

@ -0,0 +1,18 @@
[Unit]
Description=A high performance web server and a reverse proxy server
After=network.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
PrivateDevices=yes
SyslogLevel=err
ExecStartPre=/usr/bin/nginx -t -q -g 'pid /run/nginx.pid; error_log stderr;'
ExecStart=/usr/bin/nginx -g 'pid /run/nginx.pid; error_log stderr;'
ExecReload=/usr/bin/kill -HUP $MAINPID
KillSignal=SIGQUIT
KillMode=mixed
[Install]
WantedBy=multi-user.target

73
nginx.sh Normal file
View File

@ -0,0 +1,73 @@
#!/bin/bash
# general config
NGINX_CONFIG="/etc/nginx/nginx.conf"
. /etc/conf.d/nginx
. /etc/rc.conf
. /etc/rc.d/functions
function check_config {
stat_busy "Checking configuration"
/usr/bin/nginx -t -q -c "$NGINX_CONFIG"
if [ $? -ne 0 ]; then
stat_die
else
stat_done
fi
}
case "$1" in
start)
check_config
$0 careless_start
;;
careless_start)
stat_busy "Starting Nginx"
if [ -s /run/nginx.pid ]; then
stat_fail
# probably ;)
stat_busy "Nginx is already running"
stat_die
fi
/usr/bin/nginx -c "$NGINX_CONFIG" &>/dev/null
if [ $? -ne 0 ]; then
stat_fail
else
add_daemon nginx
stat_done
fi
;;
stop)
stat_busy "Stopping Nginx"
NGINX_PID=`cat /run/nginx.pid 2>/dev/null`
kill -QUIT $NGINX_PID &>/dev/null
if [ $? -ne 0 ]; then
stat_fail
else
for i in `seq 1 10`; do
[ -d /proc/$NGINX_PID ] || { stat_done; rm_daemon nginx; exit 0; }
sleep 1
done
stat_fail
fi
;;
restart)
check_config
$0 stop
sleep 1
$0 careless_start
;;
reload)
check_config
if [ -s /run/nginx.pid ]; then
status "Reloading Nginx Configuration" kill -HUP `cat /run/nginx.pid`
fi
;;
check)
check_config
;;
*)
echo "usage: $0 {start|stop|restart|reload|check|careless_start}"
esac