You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

228 lines
8.3 KiB

%global _hardened_build 1
%define nginx_user nginx
%define nginx_group %{nginx_user}
%define nginx_home %{_localstatedir}/lib/nginx
%define nginx_home_tmp %{nginx_home}/tmp
%define nginx_logdir %{_localstatedir}/log/nginx
%define nginx_confdir %{_sysconfdir}/nginx
%define nginx_datadir %{_datadir}/nginx
%define nginx_webroot %{nginx_datadir}/html
Name: nginx
Version: 1.15.2
Release: 1%{?dist}
Epoch: 1
Summary: A high performance web server and reverse proxy server
Group: System Environment/Daemons
# BSD License (two clause)
# http://www.freebsd.org/copyright/freebsd-license.html
License: BSD
URL: http://nginx.org/
Source0: http://nginx.org/download/nginx-%{version}.tar.gz
Source1: http://nginx.org/download/nginx-%{version}.tar.gz.asc
Source10: nginx.service
Source11: nginx.logrotate
Source12: nginx.conf
Source13: nginx-upgrade
Source14: nginx-upgrade.8
Source15: nginx.init
Source16: nginx.sysconfig
Source100: index.html
Source101: poweredby.png
Source102: nginx-logo.png
Source103: 404.html
Source104: 50x.html
### addons to be compiled with nginx
Source201: https://github.com/Martchus/nginx-accesskey/archive/v2.0.5.tar.gz
Source202: https://github.com/FRiCKLE/ngx_slowfs_cache/archive/1.10.tar.gz
Source203: https://github.com/nginx-modules/ngx_cache_purge/archive/2.5.tar.gz
Source204: https://github.com/eustas/ngx_brotli/archive/v0.1.2.tar.gz
#Source204: nginx-http-user-agent-785e76d.tar.xz
# 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
BuildRequires: GeoIP-devel
BuildRequires: gd-devel
BuildRequires: gperftools-devel
BuildRequires: libxslt-devel
BuildRequires: openssl-devel
BuildRequires: pcre-devel
BuildRequires: perl-devel
BuildRequires: perl(ExtUtils::Embed)
BuildRequires: zlib-devel
Requires: GeoIP
Requires: gd
Requires: openssl
Requires: pcre
#Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl
Requires(pre): shadow-utils
Provides: webserver
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description
Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
IMAP protocols, with a strong focus on high concurrency, performance and low
memory usage.
%prep
%setup -q -a 201 -a 202 -a 203 -a 204
%patch0 -p0
### add some more modules directly from upstream
git clone https://github.com/atomx/nginx-http-auth-digest nginx-http-auth-digest
git clone https://github.com/cybozu/nginx-maxconn-module nginx-maxconn-module
git clone https://github.com/nginx-modules/nginx-http-metric-module nginx-http-metric-module
git clone https://github.com/alibaba/nginx-http-user-agent nginx-http-user-agent
git clone https://github.com/eustas/ngx_brotli/ ngx_brotli
pushd ngx_brotli
git submodule update --init --recursive
popd
%build
export DESTDIR=%{buildroot}
./configure \
--prefix=%{nginx_datadir} \
--sbin-path=%{_sbindir}/nginx \
--conf-path=%{nginx_confdir}/nginx.conf \
--error-log-path=%{nginx_logdir}/error.log \
--http-log-path=%{nginx_logdir}/access.log \
--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 \
--http-uwsgi-temp-path=%{nginx_home_tmp}/uwsgi \
--http-scgi-temp-path=%{nginx_home_tmp}/scgi \
--pid-path=/run/nginx.pid \
--lock-path=/run/lock/subsys/nginx \
--user=%{nginx_user} \
--group=%{nginx_group} \
--with-ipv6 \
--with-threads \
--with-file-aio \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_geoip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-http_perl_module \
--with-mail \
--with-mail_ssl_module \
--with-pcre \
--with-pcre-jit \
--with-google_perftools_module \
--with-stream \
--with-stream_realip_module \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--add-module=nginx-accesskey-2.0.5 \
--add-module=ngx_slowfs_cache-1.10 \
--add-module=ngx_cache_purge-2.5 \
--add-module=nginx-http-auth-digest \
--add-module=nginx-maxconn-module \
--add-module=nginx-http-metric-module \
--add-module=nginx-http-user-agent \
--add-module=ngx_brotli \
--with-debug \
--with-cc-opt="%{optflags} $(pcre-config --cflags)" \
--with-ld-opt="$RPM_LD_FLAGS -Wl,-E"
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot} INSTALLDIRS=vendor
find %{buildroot} -type f -name .packlist -exec rm -f '{}' \;
find %{buildroot} -type f -name perllocal.pod -exec rm -f '{}' \;
find %{buildroot} -type f -empty -exec rm -f '{}' \;
find %{buildroot} -type f -iname '*.so' -exec chmod 0755 '{}' \;
install -p -D -m 0644 %{SOURCE10} %{buildroot}%{_unitdir}/nginx.service
install -p -D -m 0644 %{SOURCE16} %{buildroot}%{_sysconfdir}/sysconfig/nginx
install -p -D -m 0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/logrotate.d/nginx
install -p -d -m 0755 %{buildroot}%{nginx_confdir}/conf.d
install -p -d -m 0700 %{buildroot}%{nginx_home}
install -p -d -m 0700 %{buildroot}%{nginx_home_tmp}
install -p -d -m 0700 %{buildroot}%{nginx_logdir}
install -p -d -m 0755 %{buildroot}%{nginx_webroot}
install -p -m 0644 %{SOURCE12} %{buildroot}%{nginx_confdir}
install -p -m 0644 %{SOURCE100} %{buildroot}%{nginx_webroot}
install -p -m 0644 %{SOURCE101} %{SOURCE102} %{buildroot}%{nginx_webroot}
install -p -m 0644 %{SOURCE103} %{SOURCE104} %{buildroot}%{nginx_webroot}
install -p -D -m 0644 %{_builddir}/nginx-%{version}/man/nginx.8 %{buildroot}%{_mandir}/man8/nginx.8
install -p -D -m 0755 %{SOURCE13} %{buildroot}%{_bindir}/nginx-upgrade
install -p -D -m 0644 %{SOURCE14} %{buildroot}%{_mandir}/man8/nginx-upgrade.8
%pre
getent group %{nginx_group} > /dev/null || groupadd -r %{nginx_group}
getent passwd %{nginx_user} > /dev/null || \
useradd -r -d %{nginx_home} -g %{nginx_group} \
-s /sbin/nologin -c "Nginx web server" %{nginx_user}
exit 0
%post
%systemd_post nginx.service
%preun
%systemd_preun nginx.service
%postun
%systemd_postun nginx.service
%files
%doc LICENSE CHANGES README
%{nginx_datadir}/
%{_bindir}/nginx-upgrade
%{_sbindir}/nginx
%{_sbindir}/nginx.old
%{_mandir}/man3/nginx.3pm*
%{_mandir}/man8/nginx.8*
%{_mandir}/man8/nginx-upgrade.8*
%{_unitdir}/nginx.service
%config(noreplace) %{_sysconfdir}/sysconfig/nginx
%dir %{nginx_confdir}
%dir %{nginx_confdir}/conf.d
%config(noreplace) %{nginx_confdir}/fastcgi.conf
%config(noreplace) %{nginx_confdir}/fastcgi.conf.default
%config(noreplace) %{nginx_confdir}/fastcgi_params
%config(noreplace) %{nginx_confdir}/fastcgi_params.default
%config(noreplace) %{nginx_confdir}/koi-utf
%config(noreplace) %{nginx_confdir}/koi-win
%config(noreplace) %{nginx_confdir}/mime.types
%config(noreplace) %{nginx_confdir}/mime.types.default
%config(noreplace) %{nginx_confdir}/nginx.conf
%config(noreplace) %{nginx_confdir}/nginx.conf.default
%config(noreplace) %{nginx_confdir}/scgi_params
%config(noreplace) %{nginx_confdir}/scgi_params.default
%config(noreplace) %{nginx_confdir}/uwsgi_params
%config(noreplace) %{nginx_confdir}/uwsgi_params.default
%config(noreplace) %{nginx_confdir}/win-utf
%config(noreplace) %{_sysconfdir}/logrotate.d/nginx
%dir %{perl_vendorarch}/auto/nginx
%{perl_vendorarch}/nginx.pm
%{perl_vendorarch}/auto/nginx/nginx.so
%attr(700,%{nginx_user},%{nginx_group}) %dir %{nginx_home}
%attr(700,%{nginx_user},%{nginx_group}) %dir %{nginx_home_tmp}
%attr(700,%{nginx_user},%{nginx_group}) %dir %{nginx_logdir}
%changelog