# %define nginx_home %{_localstatedir}/cache/nginx %define nginx_user nginx %define nginx_group nginx %define nps_version 1.8.31.4 # distribution specific definitions %define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) %if 0%{?rhel} == 5 Group: System Environment/Daemons Requires(pre): shadow-utils Requires: initscripts >= 8.36 Requires(post): chkconfig Requires: openssl BuildRequires: openssl-devel %endif %if 0%{?rhel} == 6 Group: System Environment/Daemons Requires(pre): shadow-utils Requires: initscripts >= 8.36 Requires(post): chkconfig Requires: openssl >= 1.0.1 BuildRequires: openssl-devel >= 1.0.1 %define with_spdy 1 %endif %if 0%{?rhel} == 7 Group: System Environment/Daemons Requires(pre): shadow-utils Requires: systemd Requires: openssl >= 1.0.1 BuildRequires: systemd BuildRequires: openssl-devel >= 1.0.1 %define with_spdy 1 %endif %if 0%{?suse_version} Group: Productivity/Networking/Web/Servers BuildRequires: libopenssl-devel Requires(pre): pwdutils %endif # end of distribution specific definitions Summary: High performance web server Name: nginx Version: 1.6.0 Release: 1.el7 Vendor: nginx inc. URL: http://nginx.org/ Source0: https://nginx.org/download/%{name}-%{version}.tar.gz Source1: logrotate Source2: nginx.init Source3: nginx.sysconf Source4: nginx.conf Source5: nginx.vh.default.conf Source6: nginx.vh.example_ssl.conf Source7: nginx.suse.init Source8: nginx.service Source9: nginx.upgrade.sh License: 2-clause BSD-like license BuildRoot: %{_tmppath}/%{name}-%{version}-%{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. %package debug Summary: debug version of nginx Group: System Environment/Daemons Requires: nginx %description debug Not stripped version of nginx built with the debugging log support. %prep %setup -q cd %{_builddir}/%{name}-%{version} if [ $? -ne 0 ]; then exit $? fi chmod -Rf a+rX,u+w,g-w,o-w . %build ./configure \ --prefix=%{_sysconfdir}/nginx \ --sbin-path=%{_sbindir}/nginx \ --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-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_stub_status_module \ --with-http_auth_request_module \ --with-mail \ --with-mail_ssl_module \ --with-file-aio \ --with-ipv6 \ --with-debug \ %{?with_spdy:--with-http_spdy_module} \ --with-cc-opt="%{optflags} $(pcre-config --cflags)" \ $* make %{?_smp_mflags} %{__mv} %{_builddir}/%{name}-%{version}/objs/nginx \ %{_builddir}/%{name}-%{version}/objs/nginx.debug ./configure \ --prefix=%{_sysconfdir}/nginx \ --sbin-path=%{_sbindir}/nginx \ --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-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_stub_status_module \ --with-http_auth_request_module \ --with-mail \ --with-mail_ssl_module \ --with-file-aio \ --with-ipv6 \ %{?with_spdy:--with-http_spdy_module} \ --with-cc-opt="%{optflags} $(pcre-config --cflags)" \ $* make %{?_smp_mflags} %install %{__rm} -rf $RPM_BUILD_ROOT %{__make} DESTDIR=$RPM_BUILD_ROOT 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%{_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 %{__install} -m 644 -p %{SOURCE6} \ $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/example_ssl.conf %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig %{__install} -m 644 -p %{SOURCE3} \ $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx %if %{use_systemd} # install systemd-specific files %{__mkdir} -p $RPM_BUILD_ROOT%{_unitdir} %{__install} -m644 %SOURCE8 \ $RPM_BUILD_ROOT%{_unitdir}/nginx.service %{__mkdir} -p $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx %{__install} -m755 %SOURCE9 \ $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx/upgrade %else # install SYSV init stuff %{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir} %if 0%{?suse_version} %{__install} -m755 %{SOURCE7} \ $RPM_BUILD_ROOT%{_initrddir}/nginx %else %{__install} -m755 %{SOURCE2} \ $RPM_BUILD_ROOT%{_initrddir}/nginx %endif %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} -m644 %{_builddir}/%{name}-%{version}/objs/nginx.debug \ $RPM_BUILD_ROOT%{_sbindir}/nginx.debug %clean %{__rm} -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{_sbindir}/nginx %dir %{_sysconfdir}/nginx %dir %{_sysconfdir}/nginx/conf.d %config(noreplace) %{_sysconfdir}/nginx/nginx.conf %config(noreplace) %{_sysconfdir}/nginx/conf.d/default.conf %config(noreplace) %{_sysconfdir}/nginx/conf.d/example_ssl.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 %if %{use_systemd} %{_unitdir}/nginx.service %dir %{_libexecdir}/initscripts/legacy-actions/nginx %{_libexecdir}/initscripts/legacy-actions/nginx/* %else %{_initrddir}/nginx %endif %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 %files debug %attr(0755,root,root) %{_sbindir}/nginx.debug %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 ||: %else /sbin/chkconfig --add nginx %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 %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 * Thu Apr 24 2014 Konstantin Pavlov - 1.6.0 - http-auth-request module added