%define openssl_version 1.1.1l %define main_version 1.21.3 %define main_release 1%{?dist}.bp # addons %define nginx_openssl_opts --with-openssl=openssl --with-openssl-opt=enable-tls1_3 %define nginx_module_opts --add-module=ngx_brotli # required for brotli and co BuildRequires: git # distribution specific definitions %define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) %if 0%{?rhel} == 6 %define _group System Environment/Daemons Requires(pre): shadow-utils Requires: initscripts >= 8.36 Requires(post): chkconfig %endif %if 0%{?rhel} >= 7 %define _group System Environment/Daemons %define epoch 1 Epoch: %{epoch} Requires(pre): shadow-utils Requires: systemd BuildRequires: systemd %endif # end of distribution specific definitions %define nginx_home %{_localstatedir}/cache/nginx %define nginx_user nginx %define nginx_group nginx %define nginx_loggroup adm %define bdir %{_builddir}/%{name}-%{main_version} %define WITH_CC_OPT $(echo %{optflags} $(pcre-config --cflags)) -fPIC %define WITH_LD_OPT -Wl,-z,relro -Wl,-z,now -pie %define BASE_CONFIGURE_ARGS $(echo "--prefix=%{_sysconfdir}/nginx --sbin-path=%{_sbindir}/nginx --modules-path=%{_libdir}/nginx/modules --conf-path=%{_sysconfdir}/nginx/nginx.conf --error-log-path=%{_localstatedir}/log/nginx/error.log --http-log-path=%{_localstatedir}/log/nginx/access.log --pid-path=%{_localstatedir}/run/nginx.pid --lock-path=%{_localstatedir}/run/nginx.lock --http-client-body-temp-path=%{_localstatedir}/cache/nginx/client_temp --http-proxy-temp-path=%{_localstatedir}/cache/nginx/proxy_temp --http-fastcgi-temp-path=%{_localstatedir}/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=%{_localstatedir}/cache/nginx/uwsgi_temp --http-scgi-temp-path=%{_localstatedir}/cache/nginx/scgi_temp --user=%{nginx_user} --group=%{nginx_group} --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module %{nginx_openssl_opts} --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module %{nginx_module_opts}") Summary: High performance web server Name: nginx Version: %{main_version} Release: %{main_release} Vendor: Nginx, Inc. URL: http://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.vh.default.conf Source7: nginx-debug.sysconf Source8: nginx.service Source9: nginx.upgrade.sh Source11: nginx-debug.service Source12: COPYRIGHT Source13: nginx.check-reload.sh Source100: https://www.openssl.org/source/openssl-%{openssl_version}.tar.gz License: 2-clause BSD-like license BuildRoot: %{_tmppath}/%{name}-%{main_version}-%{main_release}-root BuildRequires: zlib-devel BuildRequires: pcre-devel Provides: webserver %description nginx [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server. %prep %setup -q mkdir openssl && tar zxf %{SOURCE100} -C openssl --strip-components 1 #git clone https://github.com/openssl/openssl.git #cd openssl #git checkout tls1.3-draft-18 #cd .. git clone https://github.com/google/ngx_brotli cd ngx_brotli && git submodule update --init 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 %build ./configure %{BASE_CONFIGURE_ARGS} \ --with-cc-opt="%{WITH_CC_OPT}" \ --with-ld-opt="%{WITH_LD_OPT}" \ --with-debug # workaround fix pthread error sed -i 's/-lpthread -lpthread -lcrypt/-pthread -lpthread -lcrypt/g' objs/Makefile make %{?_smp_mflags} %{__mv} %{bdir}/objs/nginx \ %{bdir}/objs/nginx-debug ./configure %{BASE_CONFIGURE_ARGS} \ --with-cc-opt="%{WITH_CC_OPT}" \ --with-ld-opt="%{WITH_LD_OPT}" sed -i 's/-lpthread -lpthread -lcrypt/-pthread -lpthread -lcrypt/g' objs/Makefile make %{?_smp_mflags} %install %{__rm} -rf $RPM_BUILD_ROOT %{__make} DESTDIR=$RPM_BUILD_ROOT INSTALLDIRS=vendor install %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/nginx %{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/html $RPM_BUILD_ROOT%{_datadir}/nginx/ %{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/nginx/*.default %{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/nginx/fastcgi.conf %{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/log/nginx %{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/run/nginx %{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/cache/nginx %{__mkdir} -p $RPM_BUILD_ROOT%{_libdir}/nginx/modules cd $RPM_BUILD_ROOT%{_sysconfdir}/nginx && \ %{__ln_s} ../..%{_libdir}/nginx/modules modules && cd - %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{main_version} %{__install} -m 644 -p %{SOURCE12} \ $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{main_version}/ %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/nginx.conf %{__install} -m 644 -p %{SOURCE4} \ $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 %{__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 \ $RPM_BUILD_ROOT%{_unitdir}/nginx.service %{__install} -m644 %SOURCE11 \ $RPM_BUILD_ROOT%{_unitdir}/nginx-debug.service %{__mkdir} -p $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx %{__install} -m755 %SOURCE9 \ $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx/upgrade %{__install} -m755 %SOURCE13 \ $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 %{__install} -m 644 -p %{SOURCE1} \ $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/nginx %{__install} -m755 %{bdir}/objs/nginx-debug \ $RPM_BUILD_ROOT%{_sbindir}/nginx-debug %clean %{__rm} -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{_sbindir}/nginx %{_sbindir}/nginx-debug %dir %{_sysconfdir}/nginx %dir %{_sysconfdir}/nginx/conf.d %{_sysconfdir}/nginx/modules %config(noreplace) %{_sysconfdir}/nginx/nginx.conf %config(noreplace) %{_sysconfdir}/nginx/conf.d/default.conf %config(noreplace) %{_sysconfdir}/nginx/mime.types %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 %dir %{_datadir}/nginx %dir %{_datadir}/nginx/html %{_datadir}/nginx/html/* %attr(0755,root,root) %dir %{_localstatedir}/cache/nginx %attr(0755,root,root) %dir %{_localstatedir}/log/nginx %dir %{_datadir}/doc/%{name}-%{main_version} %doc %{_datadir}/doc/%{name}-%{main_version}/COPYRIGHT %{_mandir}/man8/nginx.8* %pre # Add the "nginx" user getent group %{nginx_group} >/dev/null || groupadd -r %{nginx_group} getent passwd %{nginx_user} >/dev/null || \ useradd -r -g %{nginx_group} -s /sbin/nologin \ -d %{nginx_home} -c "nginx user" %{nginx_user} 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 </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 \ "Binary upgrade failed, please check nginx's error.log" fi %changelog * Sun Dec 30 2018 Benjamin Pereto 1.15.8-1.bp - bump to final openssl 1.1.1a - bump nginx to 1.15.8 * Mon Sep 17 2018 Benjamin Pereto 1.15.3-1.bp - bump to final openssl 1.1.1 - bump nginx to 1.15.3 * Mon Aug 20 2018 Benjamin Pereto 1.15.2-1.bp - include openssl 1.1.1pre8 * Tue May 1 2018 Benjamin Pereto 1.14.0-2.bp - include openssl 1.1.1pre6 * Wed Apr 18 2018 Benjamin Pereto 1.14.0-1.bp - include openssl 1.1.1pre5 - 1.14.0 * Tue Apr 17 2018 Benjamin Pereto 1.13.12-1.bp - include openssl 1.1.1pre4 - 1.13.12 * Sat Feb 17 2018 Benjamin Pereto 1.13.8-1.ngx - new package built with copr * Tue Dec 26 2017 Konstantin Pavlov - 1.13.8