瀏覽代碼

新增:nginx-1.21.0

呉真 3 年之前
父節點
當前提交
76e298c80d
共有 6 個文件被更改,包括 38 次插入260 次删除
  1. 0 5
      nginx-debug.sysconf
  2. 2 2
      nginx.conf
  3. 0 1
      nginx.default.conf
  4. 0 169
      nginx.init.in
  5. 36 79
      nginx.spec
  6. 0 4
      nginx.sysconf

+ 0 - 5
nginx-debug.sysconf

@@ -1,5 +0,0 @@
-# Configuration file for the nginx-debug service.
-
-NGINX=/usr/sbin/nginx-debug
-CONFFILE=/etc/nginx/nginx.conf
-LOCKFILE=/var/lock/subsys/nginx-debug

+ 2 - 2
nginx.conf

@@ -1,8 +1,8 @@
 
 user  nginx;
-worker_processes  1;
+worker_processes  auto;
 
-error_log  /var/log/nginx/error.log warn;
+error_log  /var/log/nginx/error.log notice;
 pid        /var/run/nginx.pid;
 
 

+ 0 - 1
nginx.default.conf

@@ -2,7 +2,6 @@ server {
     listen       80;
     server_name  localhost;
 
-    #charset koi8-r;
     #access_log  /var/log/nginx/host.access.log  main;
 
     location / {

+ 0 - 169
nginx.init.in

@@ -1,169 +0,0 @@
-#!/bin/sh
-#
-# nginx        Startup script for nginx
-#
-# chkconfig: - 85 15
-# processname: %PROVIDES%
-# config: /etc/nginx/nginx.conf
-# config: /etc/sysconfig/%PROVIDES%
-# pidfile: /var/run/nginx.pid
-# description: nginx is an HTTP and reverse proxy server
-#
-### BEGIN INIT INFO
-# Provides: %PROVIDES%
-# Required-Start: $local_fs $remote_fs $network
-# Required-Stop: $local_fs $remote_fs $network
-# Default-Start: %DEFAULTSTART%
-# Default-Stop: %DEFAULTSTOP%
-# Short-Description: start and stop nginx
-### END INIT INFO
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-if [ -L $0 ]; then
-    initscript=`/bin/readlink -f $0`
-else
-    initscript=$0
-fi
-
-sysconfig=`/bin/basename $initscript`
-
-if [ -f /etc/sysconfig/$sysconfig ]; then
-    . /etc/sysconfig/$sysconfig
-fi
-
-nginx=${NGINX:-/usr/sbin/%PROVIDES%}
-prog=`/bin/basename $nginx`
-conffile=${CONFFILE:-/etc/nginx/nginx.conf}
-lockfile=${LOCKFILE:-/var/lock/subsys/%PROVIDES%}
-pidfile=${PIDFILE:-/var/run/nginx.pid}
-SLEEPSEC=${SLEEPSEC:-1}
-UPGRADEWAITLOOPS=${UPGRADEWAITLOOPS:-5}
-CHECKSLEEP=${CHECKSLEEP:-3}
-RETVAL=0
-
-start() {
-    echo -n $"Starting $prog: "
-
-    daemon --pidfile=${pidfile} ${nginx} -c ${conffile}
-    RETVAL=$?
-    echo
-    [ $RETVAL = 0 ] && touch ${lockfile}
-    return $RETVAL
-}
-
-stop() {
-    echo -n $"Stopping $prog: "
-    killproc -p ${pidfile} ${prog}
-    RETVAL=$?
-    echo
-    [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
-}
-
-reload() {
-    echo -n $"Reloading $prog: "
-    killproc -p ${pidfile} ${prog} -HUP
-    RETVAL=$?
-    echo
-}
-
-upgrade() {
-    oldbinpidfile=${pidfile}.oldbin
-
-    configtest -q || return
-    echo -n $"Starting new master $prog: "
-    killproc -p ${pidfile} ${prog} -USR2
-    echo
-
-    for i in `/usr/bin/seq $UPGRADEWAITLOOPS`; do
-        /bin/sleep $SLEEPSEC
-        if [ -f ${oldbinpidfile} -a -f ${pidfile} ]; then
-            echo -n $"Graceful shutdown of old $prog: "
-            killproc -p ${oldbinpidfile} ${prog} -QUIT
-            RETVAL=$?
-            echo
-            return
-        fi
-    done
-
-    echo $"Upgrade failed!"
-    RETVAL=1
-}
-
-configtest() {
-    if [ "$#" -ne 0 ] ; then
-        case "$1" in
-            -q)
-                FLAG=$1
-                ;;
-            *)
-                ;;
-        esac
-        shift
-    fi
-    ${nginx} -t -c ${conffile} $FLAG
-    RETVAL=$?
-    return $RETVAL
-}
-
-rh_status() {
-    status -p ${pidfile} -b ${nginx} ${nginx}
-}
-
-check_reload() {
-    templog=`/bin/mktemp --tmpdir nginx-check-reload-XXXXXX.log`
-    trap '/bin/rm -f $templog' 0
-    /usr/bin/tail --pid=$$ -n 0 --follow=name /var/log/nginx/error.log > $templog &
-    /bin/sleep 1
-    /bin/echo -n $"Sending reload signal to $prog: "
-    killproc -p ${pidfile} ${prog} -HUP
-    /bin/echo
-    /bin/sleep $CHECKSLEEP
-    /bin/grep -E "\[emerg\]|\[alert\]" $templog
-}
-
-# See how we were called.
-case "$1" in
-    start)
-        rh_status >/dev/null 2>&1 && exit 0
-        start
-        ;;
-    stop)
-        stop
-        ;;
-    status)
-        rh_status
-        RETVAL=$?
-        ;;
-    restart)
-        configtest -q || exit $RETVAL
-        stop
-        start
-        ;;
-    upgrade)
-        rh_status >/dev/null 2>&1 || exit 0
-        upgrade
-        ;;
-    condrestart|try-restart)
-        if rh_status >/dev/null 2>&1; then
-            stop
-            start
-        fi
-        ;;
-    force-reload|reload)
-        reload
-        ;;
-    configtest)
-        configtest
-        ;;
-    check-reload)
-        check_reload
-        RETVAL=0
-        ;;
-    *)
-        echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|upgrade|reload|status|help|configtest|check-reload}"
-        RETVAL=2
-esac
-
-exit $RETVAL

+ 36 - 79
nginx.spec

@@ -4,29 +4,16 @@
 %define nginx_group nginx
 %define nginx_loggroup adm
 
-# distribution specific definitions
-%define use_systemd (0%{?rhel} >= 7 || 0%{?fedora} >= 19 || 0%{?suse_version} >= 1315 || 0%{?amzn} >= 2)
-
-%if %{use_systemd}
 BuildRequires: systemd
 Requires(post): systemd
 Requires(preun): systemd
 Requires(postun): systemd
-%endif
 
 %if 0%{?rhel}
 %define _group System Environment/Daemons
 %endif
 
-%if 0%{?rhel} == 6
-Requires(pre): shadow-utils
-Requires: initscripts >= 8.36
-Requires(post): chkconfig
-Requires: openssl >= 1.0.1
-BuildRequires: openssl-devel >= 1.0.1
-%endif
-
-%if 0%{?rhel} == 7
+%if (0%{?rhel} == 7) && (0%{?amzn} == 0)
 %define epoch 1
 Epoch: %{epoch}
 Requires(pre): shadow-utils
@@ -35,6 +22,14 @@ BuildRequires: openssl-devel >= 1.0.2
 %define dist .el7
 %endif
 
+%if (0%{?rhel} == 7) && (0%{?amzn} == 2)
+%define epoch 1
+Epoch: %{epoch}
+Requires(pre): shadow-utils
+Requires: openssl11 >= 1.1.1
+BuildRequires: openssl11-devel >= 1.1.1
+%endif
+
 %if 0%{?rhel} == 8
 %define epoch 1
 Epoch: %{epoch}
@@ -63,7 +58,7 @@ Requires(pre): shadow-utils
 
 %define openssl_version 1.1.1k
 
-%define base_version 1.19.10
+%define base_version 1.21.0
 %define base_release 1%{?dist}.ngx
 
 %define bdir %{_builddir}/%{name}-%{base_version}
@@ -77,24 +72,21 @@ Summary: High performance web server
 Name: nginx
 Version: %{base_version}
 Release: %{base_release}
-Vendor: Nginx, Inc.
+Vendor: NGINX Packaging <nginx-packaging@f5.com>
 URL: https://nginx.org/
 Group: %{_group}
 
 Source0: https://nginx.org/download/%{name}-%{version}.tar.gz
 Source1: logrotate
-Source2: nginx.init.in
-Source3: nginx.sysconf
-Source4: nginx.conf
-Source5: nginx.default.conf
-Source7: nginx-debug.sysconf
-Source8: nginx.service
-Source9: nginx.upgrade.sh
-Source10: nginx.suse.logrotate
-Source11: nginx-debug.service
-Source12: nginx.copyright
-Source13: nginx.check-reload.sh
-Source14: https://www.openssl.org/source/openssl-%{openssl_version}.tar.gz
+Source2: nginx.conf
+Source3: nginx.default.conf
+Source4: nginx.service
+Source5: nginx.upgrade.sh
+Source6: nginx.suse.logrotate
+Source7: nginx-debug.service
+Source8: nginx.copyright
+Source9: nginx.check-reload.sh
+Source10: https://www.openssl.org/source/openssl-%{openssl_version}.tar.gz
 
 
 
@@ -117,12 +109,7 @@ a mail proxy server.
 
 %prep
 %autosetup -p1
-cp %{SOURCE2} .
-sed -e 's|%%DEFAULTSTART%%|2 3 4 5|g' -e 's|%%DEFAULTSTOP%%|0 1 6|g' \
-    -e 's|%%PROVIDES%%|nginx|g' < %{SOURCE2} > nginx.init
-sed -e 's|%%DEFAULTSTART%%||g' -e 's|%%DEFAULTSTOP%%|0 1 2 3 4 5 6|g' \
-    -e 's|%%PROVIDES%%|nginx-debug|g' < %{SOURCE2} > nginx-debug.init
-tar -zxf %{SOURCE14}
+tar -zxf %{SOURCE10}
 
 %build
 ./configure %{BASE_CONFIGURE_ARGS} \
@@ -158,48 +145,34 @@ cd $RPM_BUILD_ROOT%{_sysconfdir}/nginx && \
     %{__ln_s} ../..%{_libdir}/nginx/modules modules && cd -
 
 %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{base_version}
-%{__install} -m 644 -p %{SOURCE12} \
+%{__install} -m 644 -p %{SOURCE8} \
     $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{base_version}/COPYRIGHT
 
 %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d
 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/nginx.conf
-%{__install} -m 644 -p %{SOURCE4} \
+%{__install} -m 644 -p %{SOURCE2} \
     $RPM_BUILD_ROOT%{_sysconfdir}/nginx/nginx.conf
-%{__install} -m 644 -p %{SOURCE5} \
-    $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/default.conf
-
-%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
 %{__install} -m 644 -p %{SOURCE3} \
-    $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx
-%{__install} -m 644 -p %{SOURCE7} \
-    $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx-debug
+    $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/default.conf
 
 %{__install} -p -D -m 0644 %{bdir}/objs/nginx.8 \
     $RPM_BUILD_ROOT%{_mandir}/man8/nginx.8
 
-%if %{use_systemd}
-# install systemd-specific files
 %{__mkdir} -p $RPM_BUILD_ROOT%{_unitdir}
-%{__install} -m644 %SOURCE8 \
+%{__install} -m644 %SOURCE4 \
     $RPM_BUILD_ROOT%{_unitdir}/nginx.service
-%{__install} -m644 %SOURCE11 \
+%{__install} -m644 %SOURCE7 \
     $RPM_BUILD_ROOT%{_unitdir}/nginx-debug.service
 %{__mkdir} -p $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx
-%{__install} -m755 %SOURCE9 \
+%{__install} -m755 %SOURCE5 \
     $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx/upgrade
-%{__install} -m755 %SOURCE13 \
+%{__install} -m755 %SOURCE9 \
     $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx/check-reload
-%else
-# install SYSV init stuff
-%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir}
-%{__install} -m755 nginx.init $RPM_BUILD_ROOT%{_initrddir}/nginx
-%{__install} -m755 nginx-debug.init $RPM_BUILD_ROOT%{_initrddir}/nginx-debug
-%endif
 
 # install log rotation stuff
 %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
 %if 0%{?suse_version}
-%{__install} -m 644 -p %{SOURCE10} \
+%{__install} -m 644 -p %{SOURCE6} \
     $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/nginx
 %else
 %{__install} -m 644 -p %{SOURCE1} \
@@ -209,6 +182,10 @@ cd $RPM_BUILD_ROOT%{_sysconfdir}/nginx && \
 %{__install} -m755 %{bdir}/objs/nginx-debug \
     $RPM_BUILD_ROOT%{_sbindir}/nginx-debug
 
+%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/koi-utf
+%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/koi-win
+%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/win-utf
+
 %check
 %{__rm} -rf $RPM_BUILD_ROOT/usr/src
 cd %{bdir}
@@ -237,22 +214,12 @@ cat /dev/null > debugsourcefiles.list
 %config(noreplace) %{_sysconfdir}/nginx/fastcgi_params
 %config(noreplace) %{_sysconfdir}/nginx/scgi_params
 %config(noreplace) %{_sysconfdir}/nginx/uwsgi_params
-%config(noreplace) %{_sysconfdir}/nginx/koi-utf
-%config(noreplace) %{_sysconfdir}/nginx/koi-win
-%config(noreplace) %{_sysconfdir}/nginx/win-utf
 
 %config(noreplace) %{_sysconfdir}/logrotate.d/nginx
-%config(noreplace) %{_sysconfdir}/sysconfig/nginx
-%config(noreplace) %{_sysconfdir}/sysconfig/nginx-debug
-%if %{use_systemd}
 %{_unitdir}/nginx.service
 %{_unitdir}/nginx-debug.service
 %dir %{_libexecdir}/initscripts/legacy-actions/nginx
 %{_libexecdir}/initscripts/legacy-actions/nginx/*
-%else
-%{_initrddir}/nginx
-%{_initrddir}/nginx-debug
-%endif
 
 %attr(0755,root,root) %dir %{_libdir}/nginx
 %attr(0755,root,root) %dir %{_libdir}/nginx/modules
@@ -278,13 +245,8 @@ exit 0
 %post
 # Register the nginx service
 if [ $1 -eq 1 ]; then
-%if %{use_systemd}
     /usr/bin/systemctl preset nginx.service >/dev/null 2>&1 ||:
     /usr/bin/systemctl preset nginx-debug.service >/dev/null 2>&1 ||:
-%else
-    /sbin/chkconfig --add nginx
-    /sbin/chkconfig --add nginx-debug
-%endif
     # print site info
     cat <<BANNER
 ----------------------------------------------------------------------
@@ -323,20 +285,12 @@ fi
 
 %preun
 if [ $1 -eq 0 ]; then
-%if %use_systemd
     /usr/bin/systemctl --no-reload disable nginx.service >/dev/null 2>&1 ||:
     /usr/bin/systemctl stop nginx.service >/dev/null 2>&1 ||:
-%else
-    /sbin/service nginx stop > /dev/null 2>&1
-    /sbin/chkconfig --del nginx
-    /sbin/chkconfig --del nginx-debug
-%endif
 fi
 
 %postun
-%if %use_systemd
 /usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||:
-%endif
 if [ $1 -ge 1 ]; then
     /sbin/service nginx status  >/dev/null 2>&1 || exit 0
     /sbin/service nginx upgrade >/dev/null 2>&1 || echo \
@@ -344,6 +298,9 @@ if [ $1 -ge 1 ]; then
 fi
 
 %changelog
+* Tue May 25 2021 Konstantin Pavlov <thresh@nginx.com> - 1.21.0-1%{?dist}.ngx
+- 1.21.0-1
+
 * Tue Apr 13 2021 Andrei Belov <defan@nginx.com> - 1.19.10-1%{?dist}.ngx
 - 1.19.10-1
 

+ 0 - 4
nginx.sysconf

@@ -1,4 +0,0 @@
-# Configuration file for the nginx service.
-
-NGINX=/usr/sbin/nginx
-CONFFILE=/etc/nginx/nginx.conf