nginx: takeover, update to 0.8.54 (note that it is a bit different port)

This commit is contained in:
Mikhail Kolesnik 2010-12-14 17:55:28 +02:00
parent b2ad236c7f
commit f1d42b98e0
6 changed files with 337 additions and 40 deletions

View File

@ -1,24 +1,44 @@
drwxr-xr-x root/root etc/
drwxr-xr-x root/root etc/nginx/
-rw-r--r-- root/root etc/nginx/fastcgi.conf
-rw-r--r-- root/root etc/nginx/fastcgi.conf.default
-rw-r--r-- root/root etc/nginx/fastcgi_params
-rw-r--r-- root/root etc/nginx/fastcgi_params.default
drwxr-xr-x root/root etc/nginx/html/
-rw-r--r-- root/root etc/nginx/html/50x.html
-rw-r--r-- root/root etc/nginx/html/index.html
-rw-r--r-- root/root etc/nginx/koi-utf
-rw-r--r-- root/root etc/nginx/koi-win
-rw-r--r-- root/root etc/nginx/mime.types
-rw-r--r-- root/root etc/nginx/mime.types.default
-rw-r--r-- root/root etc/nginx/nginx.conf
-rw-r--r-- root/root etc/nginx/nginx.conf.default
-rw-r--r-- root/root etc/nginx/scgi_params
-rw-r--r-- root/root etc/nginx/uwsgi_params
-rw-r--r-- root/root etc/nginx/win-utf
drwxr-xr-x root/root etc/rc.d/
-rwxr-xr-x root/root etc/rc.d/nginx
drwxr-xr-x root/root usr/
drwxr-xr-x root/root usr/sbin/
-rwxr-xr-x root/root usr/sbin/nginx
drwxr-xr-x root/root usr/bin/
-rwxr-xr-x root/root usr/bin/nginx
drwxr-xr-x root/root usr/lib/
drwxr-xr-x root/root usr/lib/perl5/
drwxr-xr-x root/root usr/lib/perl5/site_perl/
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.12/
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.12/linux-thread-multi/
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.12/linux-thread-multi/auto/
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.12/linux-thread-multi/auto/nginx/
-r-xr-xr-x root/root usr/lib/perl5/site_perl/5.12/linux-thread-multi/auto/nginx/nginx.so
-r--r--r-- root/root usr/lib/perl5/site_perl/5.12/linux-thread-multi/nginx.pm
drwxr-xr-x root/root usr/man/
drwxr-xr-x root/root usr/man/man3/
-r--r--r-- root/root usr/man/man3/nginx.3pm.gz
drwxr-xr-x root/root var/
drwxr-xr-x root/root var/log/
drwxr-xr-x root/root var/log/nginx/
-rw-r--r-- root/root var/log/nginx/access.log (EMPTY)
-rw-r--r-- root/root var/log/nginx/error.log (EMPTY)
drwxr-xr-x root/root var/run/
drwxr-xr-x root/root var/spool/
drwxr-xr-x root/root var/spool/nginx/
drwx------ nginx/root var/spool/nginx/client_body_temp/
drwx------ nginx/root var/spool/nginx/fastcgi_temp/
drwx------ nginx/root var/spool/nginx/proxy_temp/
drwx------ nginx/root var/spool/nginx/scgi_temp/
drwx------ nginx/root var/spool/nginx/uwscgi_temp/

View File

@ -1,2 +1,3 @@
171d88e44be3025a0bdac48c4eecd743 nginx-0.8.36.tar.gz
26c2a3112dc60d55b159fc6c2ac7e92a nginx.rc
169f1a4a3a67c83588c8d556e8407417 nginx
44df4eb6a22d725021288c570789046f nginx-0.8.54.tar.gz
d922bb31d486e33d99381f3ff8e430be nginx.conf

View File

@ -1,38 +1,59 @@
# Description: HTTP server and mail proxy
# URL: http://nginx.net
# Maintainer: Lucas Hazel, lucas at die dot net dot au
# Depends on: zlib, libpcre, openssl
# Description: Ultra fast HTTP and mail proxy server
# URL: http://nginx.net/
# Maintainer: Mikhail Kolesnik, mike at openbunker dot org
# Depends on: perl libpcre openssl
name=nginx
version=0.8.36
version=0.8.54
release=1
source=(http://sysoev.ru/nginx/$name-$version.tar.gz $name.rc)
source=(http://sysoev.ru/$name/$name-$version.tar.gz \
$name.conf \
$name)
build() {
cd $name-$version
./configure --prefix=/etc/$name \
--conf-path=/etc/$name/$name.conf \
--pid-path=/var/run/$name.pid \
--lock-path=/var/lock/$name.lock \
--error-log-path=/var/log/$name/error.log \
--http-log-path=/var/log/$name/access.log \
--user=www \
--group=www \
--http-client-body-temp-path=/var/tmp/client_body_temp \
--http-proxy-temp-path=/var/tmp/proxy_temp \
--http-fastcgi-temp-path=/var/tmp/fastcgi_temp \
--with-http_ssl_module \
--with-mail \
--with-mail_ssl_module \
--with-pcre
make
make DESTDIR=$PKG install
mkdir $PKG/usr
mv $PKG/etc/nginx/sbin $PKG/usr
rm -rf $PKG/var/run
install -D -m 0755 $SRC/$name.rc $PKG/etc/rc.d/$name
cd $name-$version
./configure --prefix=/etc/$name \
--sbin-path=/usr/bin/$name \
--conf-path=/etc/$name/$name.conf \
--pid-path=/var/run/$name.pid \
--lock-path=/var/lock/$name.lock \
--http-client-body-temp-path=/var/spool/$name/client_body_temp \
--http-proxy-temp-path=/var/spool/$name/proxy_temp \
--http-fastcgi-temp-path=/var/spool/$name/fastcgi_temp \
--http-uwsgi-temp-path=/var/spool/$name/uwscgi_temp \
--http-scgi-temp-path=/var/spool/$name/scgi_temp \
--error-log-path=/var/log/$name \
--http-log-path=/var/log/$name/access.log \
--error-log-path=/var/log/$name/error.log \
--user=$name \
--group=$name \
--with-pcre \
--with-zlib-asm=pentiumpro \
--with-http_gzip_static_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_perl_module
make
make DESTDIR=$PKG install
mkdir -p $PKG/var/spool/$name/{client_body_temp,fastcgi_temp,uwscgi_temp,scgi_temp,proxy_temp}
chown $name:0 $PKG/var/spool/$name/{client_body_temp,fastcgi_temp,uwscgi_temp,scgi_temp,proxy_temp}
chmod 700 $PKG/var/spool/$name/{client_body_temp,fastcgi_temp,uwscgi_temp,scgi_temp,proxy_temp}
touch $PKG/var/log/$name/access.log
touch $PKG/var/log/$name/error.log
install -m 644 $SRC/$name.conf $PKG/etc/$name/$name.conf
install -D -m 755 $SRC/$name $PKG/etc/rc.d/$name
rm -f $PKG/etc/$name/*.default
find $PKG/usr/lib/perl5 -name .packlist -exec rm {} \;
find $PKG/usr/lib/perl5 -name perllocal.pod -exec rm {} \;
find $PKG/usr/lib/perl5 -depth -type d -empty -exec rm -rf {} \;
find $PKG/usr/lib/perl5 -name "*.bs" -exec rm {} \;
}

105
nginx/nginx Normal file
View File

@ -0,0 +1,105 @@
#
# /etc/rc.d/nginx
#
# Adopted from Fedora Core
LOCKFILE=/var/lock/nginx.lock
PIDFILE=/var/run/nginx.pid
RETVAL=0
MAXOPENFILES=16384
NGINX=/usr/bin/nginx
start()
{
if [ -s $PIDFILE ]; then
echo "Nginx is already running"
exit 1
fi
# nginx can work with many files at one time
ulimit -n $MAXOPENFILES
$NGINX &>/dev/null
RETVAL=$?
}
stop() {
kill -QUIT `cat $PIDFILE` &>/dev/null
RETVAL=$?
}
restart()
{
stop
sleep 1
start
RETVAL=$?
}
reload() {
kill -HUP `cat $PIDFILE`
RETVAL=$?
}
testconfig()
{
$NGINX -t
RETVAL=$?
}
# this is not enabled; requires more testing
upgrade()
{
testconfig
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo -n $"Sending USR2 signal to upgrade nginx "
kill -USR2 `cat $PIDFILE`
RETVAL=$?
echo
else
RETVAL=1
fi
}
rotate() {
# it's too verbose when we are called from cron/logrotate and
# causes useless E-mail warnings in some setups
#echo -n $"Sending USR1 signal to rotate logs "
kill -USR1 `cat $PIDFILE`
#echo
RETVAL=$?
}
case "$1" in
start)
testconfig
RETVAL=$?
[ $RETVAL -eq 0 ] && start
;;
stop)
stop
;;
reload)
testconfig
RETVAL=$?
[ $RETVAL -eq 0 ] && reload
;;
restart)
restart
;;
rotate)
rotate
RETVAL=$?
;;
testconfig)
testconfig
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|reload|restart|rotate|testconfig}"
RETVAL=1
esac
exit $RETVAL

105
nginx/nginx.conf Normal file
View File

@ -0,0 +1,105 @@
#
# /etc/nginx/nginx.conf
#
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log info;
events {
worker_connections 4096;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
gzip on;
#tcp_nopush on;
sendfile on;
keepalive_timeout 65;
#passenger_root /usr/share/nginx/passenger;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
#
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
# fastcgi_param SCRIPT_FILENAME /srv/www/nginx/html$fastcgi_script_name;
#}
#
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
#
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
#
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
#
# ssl_session_timeout 5m;
#
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;
#
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
# End of file

45
nginx/pre-install Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh
#
# - add $ADD_USER user, $ADD_GROUP group
# - change files permissions
# - reflect changes in config
#
# We'll assume 'passwd', 'group' and 'shadow' files are in sync.
ADD_GID=77
ADD_UID=77
ADD_USER=nginx
ADD_USER_HOME=/etc/nginx
ADD_USER_SHELL=/bin/false
ADD_GROUP=nginx
ADD_STATUS=0
if [ -z `getent group | gawk -F: '{ print $1 }' | grep ^$ADD_GROUP$` ]; then
while [ `getent group | gawk -F: '{ print $3 }' | grep ^$ADD_GID$` ]
do
let ADD_GID+=1
done
/usr/sbin/groupadd -g $ADD_GID $ADD_GROUP || exit 1
echo "$0: Created $ADD_GROUP group, GID=$ADD_GID"
else
echo "$0: $ADD_GROUP group already exists, trying to create user..."
fi
if [ -z `getent passwd | gawk -F: '{ print $1 }' | grep ^$ADD_USER$` ]; then
while [ `getent passwd | gawk -F: '{ print $3 }' | grep ^$ADD_UID$` ]
do
let ADD_UID+=1
done
/usr/sbin/useradd -d $ADD_USER_HOME -s $ADD_USER_SHELL -u $ADD_UID -g $ADD_GROUP $ADD_USER || exit 1
echo "$0: Created $ADD_USER user, UID=$ADD_UID"
else
echo "$0: $ADD_USER user already exists"
if [[ `getent passwd | grep ^$ADD_USER: | gawk -F: '{ print $4 }'` != `getent group | grep ^$ADD_GROUP: | gawk -F: '{ print $3 }'` ]]; then
echo "$0: existing $ADD_USER user is not in $ADD_GROUP group (fix it by hand)."
ADD_STAUS=2
fi
fi
# additional
exit $ADD_STATUS