From 0a9127a6f3f61f05b31daebafb5cce403ce41e36 Mon Sep 17 00:00:00 2001 From: Jeremy Olexa Date: Wed, 11 Apr 2012 13:20:53 -0500 Subject: [www-servers/nginx] add missing files, cleanup ebuild die statements --- www-servers/nginx/files/nginx.conf | 72 +++++++++++++++++++++++++++ www-servers/nginx/files/nginx.initd | 87 +++++++++++++++++++++++++++++++++ www-servers/nginx/files/nginx.logrotate | 11 +++++ www-servers/nginx/nginx-1.1.18.ebuild | 6 +-- 4 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 www-servers/nginx/files/nginx.conf create mode 100644 www-servers/nginx/files/nginx.initd create mode 100644 www-servers/nginx/files/nginx.logrotate diff --git a/www-servers/nginx/files/nginx.conf b/www-servers/nginx/files/nginx.conf new file mode 100644 index 0000000..74c015f --- /dev/null +++ b/www-servers/nginx/files/nginx.conf @@ -0,0 +1,72 @@ +user nginx nginx; +worker_processes 1; + +error_log /var/log/nginx/error_log info; + +events { + worker_connections 1024; + use epoll; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main + '$remote_addr - $remote_user [$time_local] ' + '"$request" $status $bytes_sent ' + '"$http_referer" "$http_user_agent" ' + '"$gzip_ratio"'; + + client_header_timeout 10m; + client_body_timeout 10m; + send_timeout 10m; + + connection_pool_size 256; + client_header_buffer_size 1k; + large_client_header_buffers 4 2k; + request_pool_size 4k; + + gzip on; + gzip_min_length 1100; + gzip_buffers 4 8k; + gzip_types text/plain; + + output_buffers 1 32k; + postpone_output 1460; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + + keepalive_timeout 75 20; + + ignore_invalid_headers on; + + index index.html; + + server { + listen 127.0.0.1; + server_name localhost; + + access_log /var/log/nginx/localhost.access_log main; + error_log /var/log/nginx/localhost.error_log info; + + root /var/www/localhost/htdocs; + } + + # SSL example + #server { + # listen 127.0.0.1:443; + # server_name localhost; + + # ssl on; + # ssl_certificate /etc/ssl/nginx/nginx.pem; + # ssl_certificate_key /etc/ssl/nginx/nginx.key; + + # access_log /var/log/nginx/localhost.ssl_access_log main; + # error_log /var/log/nginx/localhost.ssl_error_log info; + + # root /var/www/localhost/htdocs; + #} +} diff --git a/www-servers/nginx/files/nginx.initd b/www-servers/nginx/files/nginx.initd new file mode 100644 index 0000000..ea11e08 --- /dev/null +++ b/www-servers/nginx/files/nginx.initd @@ -0,0 +1,87 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.initd,v 1.1 2012/02/11 10:17:30 hollow Exp $ + +extra_commands="configtest" +extra_started_commands="upgrade reload" + +description="Robust, small and high performance http and reverse proxy server" +description_configtest="Run nginx' internal config check." +description_upgrade="Upgrade the nginx binary without losing connections." +description_reload="Reload the nginx configuration without losing connections." + +nginx_config="/etc/nginx/nginx.conf" + +command="/usr/sbin/nginx" +command_args="-c ${nginx_config}" +pidfile="/var/run/nginx.pid" + +depend() { + need net + use dns logger netmount +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ]; then + configtest || return 1 + fi +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ]; then + configtest || return 1 + fi +} + +stop_post() { + rm -f ${pidfile} +} + +reload() { + configtest || return 1 + ebegin "Refreshing nginx' configuration" + kill -HUP `cat ${pidfile}` &>/dev/null + eend $? "Failed to reload nginx" +} + +upgrade() { + configtest || return 1 + ebegin "Upgrading nginx" + + einfo "Sending USR2 to old binary" + kill -USR2 `cat ${pidfile}` &>/dev/null + + einfo "Sleeping 3 seconds before pid-files checking" + sleep 3 + + if [ ! -f ${pidfile}.oldbin ]; then + eerror "File with old pid not found" + return 1 + fi + + if [ ! -f ${pidfile} ]; then + eerror "New binary failed to start" + return 1 + fi + + einfo "Sleeping 3 seconds before WINCH" + sleep 3 ; kill -WINCH `cat ${pidfile}.oldbin` + + einfo "Sending QUIT to old binary" + kill -QUIT `cat ${pidfile}.oldbin` + + einfo "Upgrade completed" + eend $? "Upgrade failed" +} + +configtest() { + ebegin "Checking nginx' configuration" + ${command} -c ${nginx_config} -t -q + + if [ $? -ne 0 ]; then + ${command} -c ${nginx_config} -t + fi + + eend $? "failed, please correct errors above" +} diff --git a/www-servers/nginx/files/nginx.logrotate b/www-servers/nginx/files/nginx.logrotate new file mode 100644 index 0000000..c9d4c5a --- /dev/null +++ b/www-servers/nginx/files/nginx.logrotate @@ -0,0 +1,11 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.logrotate,v 1.2 2011/04/08 08:32:20 hollow Exp $ + +/var/log/nginx/*_log { + missingok + sharedscripts + postrotate + test -r /var/run/nginx.pid && kill -USR1 `cat /var/run/nginx.pid` + endscript +} diff --git a/www-servers/nginx/nginx-1.1.18.ebuild b/www-servers/nginx/nginx-1.1.18.ebuild index f4da3df..9c7793f 100644 --- a/www-servers/nginx/nginx-1.1.18.ebuild +++ b/www-servers/nginx/nginx-1.1.18.ebuild @@ -285,7 +285,7 @@ src_configure() { src_compile() { # https://bugs.gentoo.org/286772 export LANG=C LC_ALL=C - emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}" || die "emake failed" + emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}" } src_install() { @@ -295,7 +295,7 @@ src_install() { dosbin objs/nginx newinitd "${FILESDIR}"/nginx.initd nginx - cp "${FILESDIR}"/nginx.conf conf/nginx.conf + cp "${FILESDIR}"/nginx.conf conf/nginx.conf || die rm conf/win-utf conf/koi-win conf/koi-utf dodir /etc/${PN} @@ -311,7 +311,7 @@ src_install() { if use nginx_modules_http_perl; then cd "${S}"/objs/src/http/modules/perl/ - einstall DESTDIR="${D}" INSTALLDIRS=vendor || die "failed to install perl stuff" + einstall DESTDIR="${D}" INSTALLDIRS=vendor fixlocalpod fi -- cgit v1.2.3-65-gdbad