2 # - /etc/sysconfig/nginx file
3 # - missing perl build/install requires
5 # Conditional build for nginx:
6 %bcond_with light # don't build light version
7 %bcond_without mail # don't build imap/mail proxy
8 %bcond_without perl # don't build with perl module
9 %bcond_without addition # adds module
10 %bcond_without dav # WebDAV
11 %bcond_without flv # FLV stream
12 %bcond_without ipv6 # build without ipv6 support
13 %bcond_without sub # ngx_http_sub_module
14 %bcond_without poll # poll
15 %bcond_without realip # real ip (behind proxy)
16 %bcond_without select # select
17 %bcond_without http2 # HTTP/2 module
18 %bcond_without status # status module
19 %bcond_without ssl # ssl support
20 %bcond_without threads # thread pool support
21 %bcond_with http_browser # header "User-agent" parser
22 %bcond_with rtmp # rtmp support
23 %bcond_with debug # enable debug logging: http://nginx.org/en/docs/debugging_log.html
24 %bcond_without auth_request # auth_request module
25 %bcond_with modsecurity # modsecurity module
31 %define ssl_version 1.0.2
32 %define rtmp_version 1.1.7
33 %define modsecurity_version 2.9.1
34 Summary: High perfomance HTTP and reverse proxy server
35 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
37 # - stable: production quality with stable API
38 # - mainline: production quality but API can change
43 Group: Networking/Daemons/HTTP
44 Source0: http://nginx.org/download/%{name}-%{version}.tar.gz
45 # Source0-md5: db43f2b19746f6f47401c3afc3924dc6
46 Source1: http://nginx.net/favicon.ico
47 # Source1-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab
49 Source3: %{name}.logrotate
51 Source6: %{name}.monitrc
53 Source14: %{name}.conf
54 Source17: %{name}-mime.types.sh
55 Source18: %{name}.service
56 Source22: http://www.modsecurity.org/tarball/%{modsecurity_version}/modsecurity-%{modsecurity_version}.tar.gz
57 # Source22-md5: 0fa92b852abc857a20b9e24f83f814cf
58 Source101: https://github.com/arut/nginx-rtmp-module/archive/v%{rtmp_version}/nginx-rtmp-module-%{rtmp_version}.tar.gz
59 # Source101-md5: 8006de2560db3e55bb15d110220076ac
60 Patch0: %{name}-no-Werror.patch
61 Patch1: %{name}-modsecurity-xheaders.patch
62 URL: http://nginx.net/
63 %{?with_modsecurity:BuildRequires: lua-devel}
64 BuildRequires: mailcap
65 %{?with_ssl:BuildRequires: openssl-devel >= %{ssl_version}}
66 BuildRequires: pcre-devel
67 %{?with_perl:BuildRequires: perl-CGI}
68 %{?with_perl:BuildRequires: perl-devel}
69 %{?with_perl:BuildRequires: python}
70 %{?with_perl:BuildRequires: rpm-perlprov}
71 BuildRequires: rpmbuild(macros) >= 1.644
72 BuildRequires: zlib-devel
73 %{?with_ssl:Requires: openssl >= %{ssl_version}}
75 Provides: group(nginx)
78 Provides: webserver(access)
79 Provides: webserver(alias)
80 Provides: webserver(auth)
81 Provides: webserver(expires)
82 Provides: webserver(headers)
83 Provides: webserver(indexfile)
84 Provides: webserver(log)
85 Provides: webserver(mime)
86 Provides: webserver(reqtimeout)
87 Provides: webserver(rewrite)
88 Provides: webserver(setenv)
89 Conflicts: logrotate < 3.8.0
90 Requires(post,preun): /sbin/chkconfig
91 Requires(post,preun,postun): systemd-units >= 38
92 Requires(postun): /usr/sbin/groupdel
93 Requires(postun): /usr/sbin/userdel
94 Requires(pre): /bin/id
95 Requires(pre): /usr/bin/getgid
96 Requires(pre): /usr/sbin/groupadd
97 Requires(pre): /usr/sbin/useradd
98 Requires: rc-scripts >= 0.2.0
99 Requires: systemd-units >= 38
100 Suggests: vim-syntax-nginx
101 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
103 %define _sysconfdir /etc/%{name}
104 %define _nginxdir /home/services/%{name}
107 nginx ("engine x") is a high-performance HTTP server and reverse
108 proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
109 Sysoev for Rambler.ru, Russia's second-most visited website, where it
110 has been running in production for over two and a half years. Igor has
111 released the source code under a BSD-like license. Although still in
112 beta, nginx is known for its stability, rich feature set, simple
113 configuration, and low resource consumption.
115 %description -l pl.UTF-8
116 nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
117 a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
118 potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
119 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
120 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
121 fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
122 prostej konfiguracji oraz małej "zasobożerności".
124 %package mod_http_perl
125 Summary: Nginx HTTP Perl module
126 Group: Networking/Daemons/HTTP
127 Requires: %{name} = %{version}-%{release}
129 %description mod_http_perl
130 Nginx HTTP Perl module.
133 Summary: Nginx mail module
134 Group: Networking/Daemons/HTTP
135 Requires: %{name} = %{version}-%{release}
137 %description mod_mail
140 %package -n monit-rc-nginx
141 Summary: nginx support for monit
142 Summary(pl.UTF-8): Wsparcie nginx dla monit
143 Group: Applications/System
144 Requires: %{name} = %{version}-%{release}
147 %description -n monit-rc-nginx
148 monitrc file for monitoring nginx webserver.
150 %description -n monit-rc-nginx -l pl.UTF-8
151 Plik monitrc do monitorowania serwera WWW nginx.
154 %setup -q %{?with_rtmp:-a101} %{?with_modsecurity:-a22}
156 %{?with_modsecurity:%patch1 -p0}
159 mv nginx-rtmp-module-%{rtmp_version} nginx-rtmp-module
162 # build mime.types.conf
163 #sh %{SOURCE17} /etc/mime.types
166 # NB: not autoconf generated configure
167 cp -f configure auto/
171 # build with default options
175 --prefix=%{_prefix} \
176 --modules-path=%{_libdir}/%{name}/modules \
177 --sbin-path=%{_sbindir}/%{name} \
178 --conf-path=%{_sysconfdir}/%{name}.conf \
179 --error-log-path=%{_localstatedir}/log/%{name}/error.log \
180 --http-log-path=%{_localstatedir}/log/%{name}/access.log \
181 --pid-path=%{_localstatedir}/run/%{name}.pid \
182 --lock-path=%{_localstatedir}/lock/subsys/%{name} \
183 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
184 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
185 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
188 %{?with_ipv6:--with-ipv6} \
189 %{?with_select:--with-select_module} \
190 %{?with_poll:--with-poll_module} \
191 %{?with_rtsig:--with-rtsig_module} \
193 --with-http_perl_module=dynamic \
196 --with-mail=dynamic \
197 --with-mail_ssl_module \
199 --with-cc="%{__cc}" \
200 --with-cc-opt="%{rpmcflags}" \
201 --with-ld-opt="%{rpmldflags}" \
202 %{?with_debug:--with-debug} \
207 %if %{with modsecurity}
208 cd modsecurity-%{modsecurity_version}
211 --enable-standalone-module \
219 %if %{with perl} && 0
221 --with-http_perl_module \
222 %{?with_addition:--with-http_addition_module} \
223 %{?with_dav:--with-http_dav_module} \
224 %{?with_flv:--with-http_flv_module} \
225 %{?with_sub:--with-http_sub_module} \
226 %{?with_realip:--with-http_realip_module} \
227 %{?with_status:--with-http_stub_status_module} \
228 %{?with_ssl:--with-http_ssl_module} \
229 %{!?with_http_browser:--without-http_browser_module} \
230 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
231 %{?with_auth_request:--with-http_auth_request_module} \
232 %{?with_threads:--with-threads} \
233 %{?with_http2:--with-http_v2_module} \
234 --with-http_secure_link_module \
237 mv -f objs/nginx bin/nginx-perl
238 mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so bin/nginx.so
239 mv -f objs/src/http/modules/perl/nginx.pm bin/nginx.pm
242 %if %{with mail} && 0
247 --with-mail_ssl_module \
250 mv -f objs/nginx bin/nginx-mail
255 %{?with_realip:--with-http_realip_module} \
256 %{?with_status:--with-http_stub_status_module} \
257 %{?with_ssl:--with-http_ssl_module} \
258 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
259 %{?with_auth_request:--with-http_auth_request_module} \
260 %{?with_threads:--with-threads} \
261 %{?with_http2:--with-http_v2_module} \
262 %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \
263 --without-http_browser_module \
264 --with-http_secure_link_module \
267 mv -f objs/nginx bin/nginx-light
271 %{?with_addition:--with-http_addition_module} \
272 %{?with_dav:--with-http_dav_module} \
273 %{?with_flv:--with-http_flv_module} \
274 %{?with_sub:--with-http_sub_module} \
275 %{?with_realip:--with-http_realip_module} \
276 %{?with_status:--with-http_stub_status_module} \
277 %{?with_ssl:--with-http_ssl_module} \
278 %{!?with_http_browser:--without-http_browser_module} \
279 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
280 %{?with_auth_request:--with-http_auth_request_module} \
281 %{?with_threads:--with-threads} \
282 %{?with_http2:--with-http_v2_module} \
283 %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \
284 --with-http_secure_link_module \
288 rm -rf $RPM_BUILD_ROOT
289 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
290 $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
291 $RPM_BUILD_ROOT%{_localstatedir}/log/{%{name},archive/%{name}} \
292 $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name} \
293 $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/%{name} \
294 $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/{vhosts,webapps}.d} \
295 $RPM_BUILD_ROOT/etc/{logrotate.d,monit} \
296 $RPM_BUILD_ROOT{%{systemdunitdir},/etc/systemd/system}
300 DESTDIR=$RPM_BUILD_ROOT
302 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/*.default
304 cp -p %{_sourcedir}/%{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}
305 cp -p %{_sourcedir}/%{name}.service $RPM_BUILD_ROOT%{systemdunitdir}
306 cp -p %{_sourcedir}/%{name}.monitrc $RPM_BUILD_ROOT/etc/monit
307 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
309 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
310 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
311 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
312 rm -r $RPM_BUILD_ROOT%{_prefix}/html
313 cp -p html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
314 cp -p html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
315 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
318 %{__rm} $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod
319 %{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/auto/nginx/.packlist
322 # only touch these for ghost packaging
323 touch $RPM_BUILD_ROOT%{_sysconfdir}/{fastcgi,scgi,uwsgi}.params
326 rm -rf $RPM_BUILD_ROOT
329 %groupadd -r -g 213 %{name}
331 %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
332 %addusertogroup %{name} http
335 for a in access.log error.log; do
336 if [ ! -f /var/log/%{name}/$a ]; then
338 touch /var/log/%{name}/$a
339 chown nginx:nginx /var/log/%{name}/$a
340 chmod 644 /var/log/%{name}/$a
343 /sbin/chkconfig --add %{name}
344 %systemd_post %{name}.service
345 %service %{name} force-reload
348 if [ "$1" = "0" ];then
349 %service %{name} stop
350 /sbin/chkconfig --del %{name}
352 %systemd_preun %{name}.service
355 if [ "$1" = "0" ]; then
361 %triggerpostun -- %{name} < 1.8.0-2
362 # skip *this* trigger on downgrade
363 [ $1 -le 1 ] && exit 0
364 ln -sf fastcgi_params %{_sysconfdir}/fastcgi.params
365 ln -sf scgi_params %{_sysconfdir}/scgi.params
366 ln -sf uwsgi_params %{_sysconfdir}/uwsgi.params
370 %defattr(644,root,root,755)
371 %doc CHANGES LICENSE README html/index.html conf/nginx.conf
372 %doc %lang(ru) CHANGES.ru
373 %dir %attr(750,root,nginx) %{_sysconfdir}
375 %dir %{_nginxdir}/cgi-bin
376 %dir %{_nginxdir}/html
377 %dir %{_nginxdir}/errors
378 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
379 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/proxy.conf
380 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fastcgi_params
381 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/scgi_params
382 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/uwsgi_params
383 %ghost %{_sysconfdir}/fastcgi.params
384 %ghost %{_sysconfdir}/scgi.params
385 %ghost %{_sysconfdir}/uwsgi.params
386 %attr(640,root,root) %{_sysconfdir}/mime.types
387 %attr(640,root,root) %{_sysconfdir}/koi-utf
388 %attr(640,root,root) %{_sysconfdir}/koi-win
389 %attr(640,root,root) %{_sysconfdir}/win-utf
390 %dir %{_sysconfdir}/webapps.d
391 %dir %{_sysconfdir}/vhosts.d
392 %attr(750,nginx,logs) %dir /var/log/archive/%{name}
393 %attr(750,nginx,logs) /var/log/%{name}
394 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
395 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
397 %defattr(644,root,root,755)
398 %attr(755,root,root) %{_sbindir}/%{name}
399 %attr(770,root,%{name}) /var/cache/%{name}
400 %attr(754,root,root) /etc/rc.d/init.d/%{name}
401 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
402 %{systemdunitdir}/%{name}.service
406 %defattr(644,root,root,755)
407 %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_mail_module.so
412 %defattr(644,root,root,755)
413 %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_perl_module.so
414 %dir %{perl_vendorarch}/auto/%{name}
415 %attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so
416 %{perl_vendorarch}/%{name}.pm
417 %{_mandir}/man3/nginx.3pm*
420 %files -n monit-rc-nginx
421 %defattr(644,root,root,755)
422 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc