Browse Source

nginx-1.18.0-7

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@12407 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop 3 years ago
parent
commit
7034027f86
1 changed files with 200 additions and 71 deletions
  1. 200 71
      n/nginx/nginx-vl.spec

+ 200 - 71
n/nginx/nginx-vl.spec

@@ -1,4 +1,5 @@
-%global nginx_version 1.16.1
+%bcond_with systemd
+%global nginx_version 1.18.0
 
 # build mod_wsgi
 %bcond_with wsgi
@@ -7,12 +8,16 @@
 %if "%{_dist_release}" >= "vl7"
 %bcond_without geoip
 %bcond_without geoip2
-%bcond_without naxsi
-%bcond_without modsecurity
 %else
 %bcond_with geoip
 %endif
 
+# build naxsi module
+%bcond_with naxsi
+
+# build modsecurity module
+%bcond_without modsecurity
+
 %global nginx_modulesdir %{_libdir}/nginx/modules
 %global nginx_modconfdir %{_sysconfdir}/nginx/modules.d
 
@@ -33,104 +38,112 @@
 Summary:        Robust, small and high performance http and reverse proxy server
 Summary(ja):    堅牢・軽量・高性能な HTTP およびリバースプロキシサーバ
 Name:           nginx
+Group:          System Environment/Daemons   
 Version:        %{nginx_version}
 # do not reset or decrease.
-Release:        5%{?_dist_release}
+Release:        7%{?_dist_release}%{?with_systemd:.systemd}
 
-Group:          System Environment/Daemons   
 # BSD License (two clause)
 # http://www.freebsd.org/copyright/freebsd-license.html
 License:        BSD
-URL:            http://nginx.net/ 
-
-Source0:    http://sysoev.ru/nginx/nginx-%{version}.tar.gz
-Source1:    %{name}.init
-Source2:    %{name}.logrotate
-Source3:    nginx-virtual.conf.template
-Source4:    nginx-ssl.conf
-Source5:    %{name}.sysconfig
-Source10:   nginx-vine.conf
-Source11:   nginx-default-vine
-Source20:   proxy_cache.conf
-Source100:  nginx-index.html
-Source101:  poweredby-vine.png
-Source102:  nginx-logo.png
-Source103:  nginx-50x.html
-Source104:  nginx-404.html
-
-%define ngx_fancyindex_version 0.4.3
-Source1000: ngx-fancyindex-%{ngx_fancyindex_version}.tar.gz
-
-%define nginx_accept_language_module_version 2f69842
-Source1010: giom-nginx_accept_language_module-%{nginx_accept_language_module_version}.tar.gz
-
-## https://github.com/phusion/passenger/archive/release-%{passenger_version}.tar.gz
-%define passenger_version 6.0.2
-Source1020: passenger-%{passenger_version}.tar.gz
-
-%define upstream_fair_version a18b409
-Source1030: gnosek-nginx-upstream-fair-%{upstream_fair_version}.tar.gz
-
-%define mod_wsgi_version 6975f0ec7eeb
-Source2000: lifeeth-mod_wsgi-%{mod_wsgi_version}.tar.bz2
-
-%define nginx_dav_ext_module_version 3.0.0
-Source2010: https://github.com/arut/nginx-dav-ext-module/archive/v%{nginx_dav_ext_module_version}.tar.gz#/nginx-dav-ext-module-%{nginx_dav_ext_module_version}.tar.gz
+URL:            https://nginx.org/
+Source0:        https://nginx.org/download/nginx-%{version}.tar.gz
+Source1:        %{name}.init
+Source2:        %{name}.logrotate
+Source3:        nginx-virtual.conf.template
+Source4:        nginx-ssl.conf
+Source5:        %{name}.sysconfig
+Source10:       nginx-vine.conf
+Source11:       nginx-default-vine
+Source20:       proxy_cache.conf
+Source21:       nginx.service
+Source22:       nginx-upgrade
+Source23:       nginx-upgrade.8
+Source100:      nginx-index.html
+Source101:      poweredby-vine.png
+Source102:      nginx-logo.png
+Source103:      nginx-50x.html
+Source104:      nginx-404.html
+
+%define         ngx_fancyindex_version 0.4.3
+Source1000:     ngx-fancyindex-%{ngx_fancyindex_version}.tar.gz
+
+%define         nginx_accept_language_module_version 2f69842
+Source1010:     giom-nginx_accept_language_module-%{nginx_accept_language_module_version}.tar.gz
+
+%define         passenger_version 6.0.4
+Source1020:     https://github.com/phusion/passenger/releases/download/release-%{passenger_version}/passenger-%{passenger_version}.tar.gz
+
+%define         upstream_fair_version a18b409
+Source1030:     gnosek-nginx-upstream-fair-%{upstream_fair_version}.tar.gz
+
+%define         mod_wsgi_version 6975f0ec7eeb
+Source2000:     lifeeth-mod_wsgi-%{mod_wsgi_version}.tar.bz2
+
+%define         nginx_dav_ext_module_version 3.0.0
+Source2010:     https://github.com/arut/nginx-dav-ext-module/archive/v%{nginx_dav_ext_module_version}.tar.gz#/nginx-dav-ext-module-%{nginx_dav_ext_module_version}.tar.gz
 
 %if %{with naxsi}
-%global with_naxsi 1
-%global naxsi_version 0.56
-%global naxsi_srcversion untagged-afabfc163946baa8036f
-Source2020:  https://github.com/nbs-system/naxsi/archive/%{naxsi_srcversion}.tar.gz#/naxsi-%{naxsi_srcversion}.tar.gz
-Source2021:  naxsi_params
+%global         with_naxsi 1
 %endif
+%global         naxsi_version 0.56
+%global         naxsi_srcversion untagged-afabfc163946baa8036f
+Source2020:     https://github.com/nbs-system/naxsi/archive/%{naxsi_srcversion}.tar.gz#/naxsi-%{naxsi_srcversion}.tar.gz
+Source2021:     naxsi_params
 
 %if %{with geoip2}
-%global with_geoip2 1
-%global geoip2_version 3.2
-Source2030: https://github.com/leev/ngx_http_geoip2_module/archive/%{geoip2_version}.tar.gz#/ngx_http_geoip2_module-3.2.tar.gz
+%global         with_geoip2 1
+%global         geoip2_version 3.3
+Source2030:     https://github.com/leev/ngx_http_geoip2_module/archive/%{geoip2_version}.tar.gz#/ngx_http_geoip2_module-%{geoip2_version}.tar.gz
 %endif
 
 %if %{with modsecurity}
-%global with_modsecurity 1
-%global modsecurity_version 1.0.1
-Source2040: https://github.com/SpiderLabs/ModSecurity-nginx/releases/download/v%{modsecurity_version}/modsecurity-nginx-v%{modsecurity_version}.tar.gz
+%global         with_modsecurity 1
+%global         modsecurity_version 1.0.1
+Source2040:     https://github.com/SpiderLabs/ModSecurity-nginx/releases/download/v%{modsecurity_version}/modsecurity-nginx-v%{modsecurity_version}.tar.gz
 %endif
 
 # removes -Werror in upstream build scripts.  -Werror conflicts with
 # -D_FORTIFY_SOURCE=2 causing warnings to turn into errors.
-Patch0:     nginx-auto-cc-gcc.patch
+Patch0:         nginx-auto-cc-gcc.patch
 
 # to fix https://svn.boost.org/trac/boost/ticket/8731
-Patch100:   boost-changeset_84950.diff
+Patch100:       boost-changeset_84950.diff
 
 # to fix https://github.com/gnosek/nginx-upstream-fair/pull/23
-Patch101:   gnosek-nginx-upstream-fair-pull-23.patch
+Patch101:       gnosek-nginx-upstream-fair-pull-23.patch
 
 # to fix compile error with C++11.
-Patch1000: passenger-5.0.28-boost.patch
+Patch1000:      passenger-5.0.28-boost.patch
 
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root
 
 %if "%{_dist_release}" > "vl6"
-BuildRequires:      libboost-devel
+BuildRequires:  libboost-devel
 %endif
-BuildRequires:      libxcrypt-devel
-BuildRequires:      libnsl2-devel
-BuildRequires:      pcre-devel
-BuildRequires:      zlib-devel
-BuildRequires:      openssl-devel
-BuildRequires:	    libxml2-devel
-BuildRequires:	    libxslt-devel
-BuildRequires:	    curl-devel
-
-Requires:           perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+BuildRequires:  libxcrypt-devel
+BuildRequires:  libnsl2-devel
+BuildRequires:  pcre-devel
+BuildRequires:  zlib-devel
+BuildRequires:  openssl-devel
+BuildRequires:	libxml2-devel
+BuildRequires:	libxslt-devel
+BuildRequires:	curl-devel
+
+Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
 # for /usr/sbin/useradd
 Requires(pre):      shadow-utils
+%if %{with systemd}
+BuildRequires:     systemd
+Requires(post):    systemd
+Requires(preun):   systemd
+Requires(postun):  systemd
+%else
 Requires(post):     chkconfig
 # for /sbin/service
 Requires(preun):    chkconfig, initscripts
 Requires(postun):   initscripts
+%endif
 %if "%{_dist_release}" > "vl6"
 Requires(pre):	    www-common
 %endif
@@ -305,6 +318,9 @@ This connector is required to use LibModSecurity with nginx.
 %endif
 
 
+%debug_package
+
+
 %prep
 %setup -q -a 1000 -a 1010 -a 1020 -a 1030 %{?with_wsgi:-a 2000} -a 2010 %{?with_naxsi:-a 2020} %{?with_geoip2:-a 2030} %{?with_modsecurity:-a 2040}
 
@@ -350,7 +366,11 @@ CONFIGOPTS="\
     --http-client-body-temp-path=%{nginx_home_tmp}/client_body \
     --http-proxy-temp-path=%{nginx_home_tmp}/proxy \
     --http-fastcgi-temp-path=%{nginx_home_tmp}/fastcgi \
+%if %{with systemd}
+    --pid-path=/run/nginx.pid \
+%else
     --pid-path=%{_localstatedir}/run/%{name}.pid \
+%endif
     --lock-path=%{_localstatedir}/lock/subsys/%{name} \
     --with-file-aio \
     --with-ipv6 \
@@ -419,14 +439,31 @@ find %{buildroot} -type f -empty -exec rm -f {} \;
 find %{buildroot} -type f -exec chmod 0644 {} \;
 find %{buildroot} -type f -name '*.so' -exec chmod 0755 {} \;
 chmod 0755 %{buildroot}%{_sbindir}/nginx
+
+%if %{with systemd}
+install -p -d -m 0755 %{buildroot}%{_unitdir}
+install -p -D -m 0644 %{SOURCE21} \
+    %{buildroot}%{_unitdir}/nginx.service
+sed -i -e 's#KillMode=.*#KillMode=process#g' \
+    %{buildroot}%{_unitdir}/nginx.service
+install -p -D -m 0755 %{SOURCE22} %{buildroot}%{_bindir}/nginx-upgrade
+install -p -D -m 0644 %{SOURCE23} %{buildroot}%{_mandir}/man8/nginx-upgrade.8
+%else
 %{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
+%endif
+
 %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
 %{__install} -p -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
 %{__install} -p -d -m 0755 %{buildroot}%{nginx_confdir}/conf.d
 %{__install} -p -d -m 0755 %{buildroot}%{nginx_confdir}/sites.d
 %{__install} -p -m 0644 %{SOURCE3} %{buildroot}%{nginx_confdir}/sites.d/virtual.conf.template
 %{__install} -p -m 0644 %{SOURCE4} %{buildroot}%{nginx_confdir}/conf.d/ssl.conf
-%{__sed} -e 's/__NGINXUSER__/%{nginx_user}/g' %{SOURCE10} > %{buildroot}%{nginx_confdir}/nginx.conf
+%{__sed} \
+	-e 's/__NGINXUSER__/%{nginx_user}/g' \
+%if %{with systemd}
+	-e 's|/var/run/nginx.pid|/run/nginx.pid|g' \
+%endif
+	%{SOURCE10} > %{buildroot}%{nginx_confdir}/nginx.conf
 %{__cp} %{buildroot}%{nginx_confdir}/nginx.conf %{buildroot}%{nginx_confdir}/nginx.conf.default
 %{__install} -p -m 0644 %{SOURCE11} %{buildroot}%{nginx_confdir}/sites.d/default
 %{__install} -p -m 0644 %{SOURCE20} %{buildroot}%{nginx_confdir}/conf.d/proxy_cache.conf
@@ -526,20 +563,99 @@ if [ -L %{_sbindir}/nginx ]; then
 fi
 
 %post
+%if %{with systemd}
+%systemd_post nginx.service
+%else
 if [ $1 == 1 ]; then
     /sbin/chkconfig --add %{name}
 fi
+%endif
 
 %preun
-if [ $1 = 0 ]; then
+%if %{with systemd}
+%systemd_preun nginx.service
+%else
+if [ $1 = 0 -o -x /bin/systemctl ]; then
     /sbin/service %{name} stop >/dev/null 2>&1
     /sbin/chkconfig --del %{name}
 fi
+%endif
 
 %postun
+%if %{with systemd}
+%systemd_postun nginx.service
+if [ $1 -ge 1 ]; then
+    /usr/bin/nginx-upgrade >/dev/null 2>&1 || :
+fi
+%else
 if [ $1 == 2 ]; then
     /sbin/service %{name} upgrade || :
 fi
+%endif
+
+%if %{with systemd}
+%if %{with geoip}
+%post geoip
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+%endif
+
+%post image-filter
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+
+%post perl
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+
+%post xslt-filter
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+
+%post mail
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+
+%post stream
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+
+%post dav-ext
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+
+%post http-geoip2
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+
+%post stream-geoip2
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+
+%if %{with naxsi}
+%post naxsi
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+%endif
+
+%if %{with modsecurity}
+%post modsecurity
+if [ $1 -eq 1 ]; then
+    systemctl reload nginx.service >/dev/null 2>&1 || :
+fi
+%endif
+%endif
+
 
 %files
 %defattr(-,root,root,-)
@@ -550,7 +666,13 @@ fi
 %{nginx_datadir}/
 %{_sbindir}/%{name}
 %{_mandir}/man3/%{name}.3pm.gz
+%if %{with systemd}
+%{_bindir}/nginx-upgrade
+%{_mandir}/man8/nginx-upgrade.8*
+%{_unitdir}/nginx.service
+%else
 %{_initrddir}/%{name}
+%endif
 %dir %{nginx_modulesdir}
 %dir %{nginx_modconfdir}
 %dir %{nginx_confdir}
@@ -576,8 +698,6 @@ fi
 %if %{with wsgi}
 %config(noreplace) %{nginx_confdir}/wsgi_vars
 %endif
-%config(noreplace) %{nginx_confdir}/naxsi_params
-%config(noreplace) %{nginx_confdir}/naxsi_core.rules
 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
 %attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home}
@@ -652,6 +772,8 @@ fi
 %doc README.naxsi.md
 %{nginx_modulesdir}/ngx_http_naxsi_module.so
 %config(noreplace) %{nginx_modconfdir}/naxsi.conf
+%config(noreplace) %{nginx_confdir}/naxsi_params
+%config(noreplace) %{nginx_confdir}/naxsi_core.rules
 %endif
 
 %if %{with modsecurity}
@@ -664,6 +786,13 @@ fi
 %endif
 
 %changelog
+* Tue May 19 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.18.0-1
+- updated to 1.18.0.
+- disabled NAXSI as default.
+
+* Sun Apr 05 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.16.1-6
+- added systemd support (disabled as default).
+
 * Mon Mar 09 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.16.1-5
 - updated modsecurity module to 1.0.1.
 - dropped Patch2040 and 2041: fixed in upstream.