]> git.pld-linux.org Git - packages/nginx.git/blame_incremental - nginx.spec
- rel 2; do not override defaults especially such like non-proxy ones (client_*)
[packages/nginx.git] / nginx.spec
... / ...
CommitLineData
1# TODO
2# - /etc/sysconfig/nginx file
3# - missing perl build/install requires
4#
5# Conditional build for nginx:
6# Features
7%bcond_with debug # enable debug logging: http://nginx.org/en/docs/debugging_log.html
8%bcond_without threads # thread pool support
9# Modules
10%bcond_without addition # http addition module
11%bcond_without auth_request # auth_request module
12%bcond_without dav # WebDAV
13%bcond_without flv # http FLV module
14%bcond_without gd # without http image filter module
15%bcond_without geoip # without http geoip module and stream geoip module
16%bcond_without http2 # HTTP/2 module
17%bcond_without mail # don't build imap/mail proxy
18%bcond_without perl # don't build with perl module
19%bcond_without poll # poll module
20%bcond_without realip # real ip (behind proxy)
21%bcond_without select # select module
22%bcond_without ssl # ssl support and http ssl module
23%bcond_without stream # TCP/UDP proxy module
24%bcond_without stub_status # http stub status module
25%bcond_without sub # ngx_http_sub_module
26%bcond_without xslt # without http xslt module
27%bcond_with http_browser # http browser module (header "User-agent" parser)
28%bcond_with modsecurity # modsecurity module
29%bcond_with rtmp # rtmp support
30%bcond_without vts # virtual host traffic status module
31
32%ifarch x32
33%undefine with_rtsig
34%endif
35
36%define ssl_version 1.0.2
37%define rtmp_version 1.2.1
38%define vts_version 0.1.18
39%define modsecurity_version 2.9.3
40Summary: High perfomance HTTP and reverse proxy server
41Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
42# nginx lines:
43# - stable: production quality with stable API
44# - mainline: production quality but API can change
45Name: nginx
46Version: 1.16.1
47Release: 2
48License: BSD-like
49Group: Networking/Daemons/HTTP
50Source0: http://nginx.org/download/%{name}-%{version}.tar.gz
51# Source0-md5: 45a80f75336c980d240987badc3dcf60
52Source1: http://nginx.net/favicon.ico
53# Source1-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab
54Source2: proxy.conf
55Source3: %{name}.logrotate
56Source4: %{name}.mime
57Source6: %{name}.monitrc
58Source7: %{name}.init
59Source14: %{name}.conf
60Source17: %{name}-mime.types.sh
61Source18: %{name}.service
62Source22: http://www.modsecurity.org/tarball/%{modsecurity_version}/modsecurity-%{modsecurity_version}.tar.gz
63# Source22-md5: 215a96d679a5b0fadcf13b5d09b35422
64Source101: https://github.com/arut/nginx-rtmp-module/archive/v%{rtmp_version}/%{name}-rtmp-module-%{rtmp_version}.tar.gz
65# Source101-md5: 639ac2b78103adaccbcfe484a92acf44
66Source102: https://github.com/vozlt/nginx-module-vts/archive/v%{vts_version}.tar.gz
67# Source102-md5: 409a10dbd85e0b807cc77eecec29a3b5
68Patch0: %{name}-no-Werror.patch
69Patch1: %{name}-modsecurity-xheaders.patch
70URL: http://nginx.org/
71BuildRequires: mailcap
72BuildRequires: pcre-devel
73BuildRequires: rpmbuild(macros) >= 1.644
74BuildRequires: zlib-devel
75%if %{with geoip}
76BuildRequires: GeoIP-devel
77%endif
78%if %{with gd}
79BuildRequires: gd-devel
80%endif
81%if %{with modsecurity}
82BuildRequires: lua-devel
83%endif
84%if %{with perl}
85BuildRequires: perl-CGI
86BuildRequires: perl-devel
87BuildRequires: python
88BuildRequires: rpm-perlprov
89%endif
90%if %{with ssl}
91BuildRequires: openssl-devel >= %{ssl_version}
92Requires: openssl >= %{ssl_version}
93%endif
94%if %{with xslt}
95BuildRequires: libxslt-devel
96%endif
97Provides: group(http)
98Provides: group(nginx)
99Provides: user(nginx)
100Provides: webserver
101Provides: webserver(access)
102Provides: webserver(alias)
103Provides: webserver(auth)
104Provides: webserver(expires)
105Provides: webserver(headers)
106Provides: webserver(indexfile)
107Provides: webserver(log)
108Provides: webserver(mime)
109Provides: webserver(reqtimeout)
110Provides: webserver(rewrite)
111Provides: webserver(setenv)
112Conflicts: logrotate < 3.8.0
113Requires(post,preun): /sbin/chkconfig
114Requires(post,preun,postun): systemd-units >= 38
115Requires(postun): /usr/sbin/groupdel
116Requires(postun): /usr/sbin/userdel
117Requires(pre): /bin/id
118Requires(pre): /usr/bin/getgid
119Requires(pre): /usr/sbin/groupadd
120Requires(pre): /usr/sbin/useradd
121Requires: rc-scripts >= 0.2.0
122Requires: systemd-units >= 38
123Suggests: vim-syntax-nginx
124Obsoletes: nginx-common < 1.13.3
125Obsoletes: nginx-light < 1.13.3
126Obsoletes: nginx-standard < 1.13.3
127Conflicts: rpm < 4.4.2-0.2
128BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
129
130%define _sysconfdir /etc/%{name}
131%define _nginxdir /home/services/%{name}
132
133# minimizing restarts logics. we restart webserver:
134#
135# 1. at the end of transaction. (posttrans, feature from rpm 4.4.2)
136# 2. first install of module (post: $1 = 1)
137# 2. uninstall of module (postun: $1 == 0)
138#
139# the strict internal deps between modules and
140# main package are very important for all this to work.
141
142# restart webserver at the end of transaction
143
144%define restart_webserver \
145 %systemd_post %{name}.service \
146 %service %{name} force-reload \
147 %{nil}
148
149# macro called at module post scriptlet
150%define module_post \
151if [ "$1" = "1" ]; then \
152 %restart_webserver \
153fi
154
155# macro called at module postun scriptlet
156%define module_postun \
157if [ "$1" = "0" ]; then \
158 %restart_webserver \
159fi
160
161# it's sooo annoying to write them
162%define module_scripts() \
163%post %1 \
164%module_post \
165\
166%postun %1 \
167%module_postun
168
169%description
170nginx ("engine x") is a high-performance HTTP server and reverse
171proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
172Sysoev for Rambler.ru, Russia's second-most visited website, where it
173has been running in production for over two and a half years. Igor has
174released the source code under a BSD-like license. Although still in
175beta, nginx is known for its stability, rich feature set, simple
176configuration, and low resource consumption.
177
178%description -l pl.UTF-8
179nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
180a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
181potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
182odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
183opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
184fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
185prostej konfiguracji oraz małej "zasobożerności".
186
187%package mod_http_geoip
188Summary: Nginx HTTP geoip module
189Group: Daemons
190Requires: %{name} = %{version}-%{release}
191Requires: GeoIP
192
193%description mod_http_geoip
194Nginx HTTP geoip module.
195
196%package mod_stream_geoip
197Summary: Nginx stream geoip module
198Group: Daemons
199Requires: %{name} = %{version}-%{release}
200Requires: %{name}-mod_stream = %{version}-%{release}
201Requires: GeoIP
202
203%description mod_stream_geoip
204Nginx stream geoip module.
205
206%package mod_http_image_filter
207Summary: Nginx HTTP image filter module
208Group: Daemons
209Requires: %{name} = %{version}-%{release}
210
211%description mod_http_image_filter
212Nginx HTTP image filter module.
213
214%package mod_http_perl
215Summary: Nginx HTTP Perl module
216Group: Networking/Daemons/HTTP
217Requires: %{name} = %{version}-%{release}
218
219%description mod_http_perl
220Nginx HTTP Perl module.
221
222%package mod_http_xslt_filter
223Summary: Nginx XSLT module
224Group: Daemons
225Requires: %{name} = %{version}-%{release}
226
227%description mod_http_xslt_filter
228Nginx XSLT module.
229
230%package mod_mail
231Summary: Nginx mail module
232Group: Networking/Daemons/HTTP
233Requires: %{name} = %{version}-%{release}
234
235%description mod_mail
236Nginx mail module.
237
238%package mod_vts
239Summary: Nginx virtual host traffic status module
240Group: Networking/Daemons/HTTP
241Requires: %{name} = %{version}-%{release}
242
243%description mod_vts
244Nginx virtual host traffic status module.
245
246%package mod_stream
247Summary: Nginx stream modules
248Group: Daemons
249Requires: %{name} = %{version}-%{release}
250
251%description mod_stream
252Nginx stream modules.
253
254%package -n monit-rc-nginx
255Summary: nginx support for monit
256Summary(pl.UTF-8): Wsparcie nginx dla monit
257Group: Applications/System
258Requires: %{name} = %{version}-%{release}
259Requires: monit
260
261%description -n monit-rc-nginx
262monitrc file for monitoring nginx webserver.
263
264%description -n monit-rc-nginx -l pl.UTF-8
265Plik monitrc do monitorowania serwera WWW nginx.
266
267%prep
268%setup -q %{?with_rtmp:-a101} %{?with_modsecurity:-a22} %{?with_vts:-a102}
269%patch0 -p0
270%{?with_modsecurity:%patch1 -p0}
271
272%if %{with rtmp}
273mv nginx-rtmp-module-%{rtmp_version} nginx-rtmp-module
274%endif
275
276%if %{with vts}
277mv nginx-module-vts-%{vts_version} nginx-vts-module
278%endif
279
280# build mime.types.conf
281#sh %{SOURCE17} /etc/mime.types
282
283%build
284# NB: not autoconf generated configure
285cp -f configure auto/
286
287./configure \
288 --prefix=%{_prefix} \
289 --modules-path=%{_libdir}/%{name}/modules \
290 --sbin-path=%{_sbindir}/%{name} \
291 --conf-path=%{_sysconfdir}/%{name}.conf \
292 --error-log-path=%{_localstatedir}/log/%{name}/error.log \
293 --http-log-path=%{_localstatedir}/log/%{name}/access.log \
294 --pid-path=%{_localstatedir}/run/%{name}.pid \
295 --lock-path=%{_localstatedir}/lock/subsys/%{name} \
296 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
297 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
298 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
299 --http-uwsgi-temp-path=%{_localstatedir}/cache/%{name}/uwsgi_temp \
300 --http-scgi-temp-path=%{_localstatedir}/cache/%{name}/scgi_temp \
301 --user=nginx \
302 --group=nginx \
303 %{?with_select:--with-select_module} \
304 %{?with_poll:--with-poll_module} \
305 %{?with_rtsig:--with-rtsig_module} \
306 %{?with_perl:--with-http_perl_module=dynamic} \
307 %{?with_gd:--with-http_image_filter_module=dynamic} \
308 %{?with_xslt:--with-http_xslt_module=dynamic} \
309 %{?with_geoip:--with-http_geoip_module=dynamic} \
310 %{?with_geoip:--with-stream_geoip_module=dynamic} \
311%if %{with mail}
312 --with-mail=dynamic \
313 --with-mail_ssl_module \
314%endif
315%if %{with stream}
316 --with-stream=dynamic \
317 --with-stream_ssl_module \
318%endif
319 --with-cc="%{__cc}" \
320 --with-cc-opt="%{rpmcflags}" \
321 --with-ld-opt="%{rpmldflags}" \
322 %{?with_debug:--with-debug} \
323 %{?with_addition:--with-http_addition_module} \
324 %{?with_dav:--with-http_dav_module} \
325 %{?with_flv:--with-http_flv_module} \
326 %{?with_sub:--with-http_sub_module} \
327 %{?with_realip:--with-http_realip_module} \
328 %{?with_stub_status:--with-http_stub_status_module} \
329 %{?with_ssl:--with-http_ssl_module} \
330 %{!?with_http_browser:--without-http_browser_module} \
331 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
332 %{?with_vts:--add-dynamic-module=./nginx-vts-module} \
333 %{?with_auth_request:--with-http_auth_request_module} \
334 %{?with_threads:--with-threads} \
335 %{?with_http2:--with-http_v2_module} \
336 %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \
337 --with-http_secure_link_module \
338 %{nil}
339
340%{__make}
341
342%if %{with modsecurity}
343cd modsecurity-%{modsecurity_version}
344./autogen.sh
345%configure \
346 --enable-standalone-module \
347 --disable-mlogc \
348 --enable-alp2 \
349 --with-lua=/usr
350%{__make}
351cd ..
352%endif
353
354%install
355rm -rf $RPM_BUILD_ROOT
356install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
357 $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
358 $RPM_BUILD_ROOT%{_localstatedir}/log/{%{name},archive/%{name}} \
359 $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name} \
360 $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/%{name} \
361 $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/{conf,modules,vhosts,webapps}.d} \
362 $RPM_BUILD_ROOT%{_sysconfdir}/snippets \
363 $RPM_BUILD_ROOT/etc/{logrotate.d,monit} \
364 $RPM_BUILD_ROOT{%{systemdunitdir},/etc/systemd/system}
365
366%{__make} install \
367 INSTALLDIRS=vendor \
368 DESTDIR=$RPM_BUILD_ROOT
369
370%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/*.default
371
372cp -p %{_sourcedir}/%{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}
373cp -p %{_sourcedir}/%{name}.service $RPM_BUILD_ROOT%{systemdunitdir}
374cp -p %{_sourcedir}/%{name}.monitrc $RPM_BUILD_ROOT/etc/monit
375install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
376
377cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
378cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
379cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
380rm -r $RPM_BUILD_ROOT%{_prefix}/html
381cp -p html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
382cp -p html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
383cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
384
385load_module() {
386 local module=ngx_${1}_module.so conffile=mod_$1.conf
387 printf 'load_module "%{_libdir}/%{name}/modules/%s";' "$module" \
388 > $RPM_BUILD_ROOT%{_sysconfdir}/modules.d/$conffile
389}
390
391%if %{with perl}
392%{__rm} $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod
393%{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/auto/nginx/.packlist
394load_module http_perl
395%endif
396
397%if %{with geoip}
398load_module http_geoip
399load_module stream_geoip
400%endif
401%if %{with gd}
402load_module http_image_filter
403%endif
404%if %{with xslt}
405load_module http_xslt_filter
406%endif
407%if %{with mail}
408load_module mail
409%endif
410%{?with_vts:load_module http_vhost_traffic_status}
411%if %{with stream}
412load_module stream
413%endif
414
415%clean
416rm -rf $RPM_BUILD_ROOT
417
418%pre
419%groupadd -r -g 213 %{name}
420%groupadd -g 51 http
421%useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
422%addusertogroup %{name} http
423
424%post
425for a in access.log error.log; do
426 if [ ! -f /var/log/%{name}/$a ]; then
427 umask 022
428 touch /var/log/%{name}/$a
429 chown nginx:nginx /var/log/%{name}/$a
430 chmod 644 /var/log/%{name}/$a
431 fi
432done
433/sbin/chkconfig --add %{name}
434
435%posttrans
436%restart_webserver
437
438%preun
439if [ "$1" = "0" ];then
440 %service %{name} stop
441 /sbin/chkconfig --del %{name}
442fi
443%systemd_preun %{name}.service
444
445%postun
446if [ "$1" = "0" ]; then
447 %userremove %{name}
448 %groupremove %{name}
449fi
450%systemd_reload
451
452%module_scripts mod_http_geoip
453%module_scripts mod_http_image_filter
454%module_scripts mod_http_perl
455%module_scripts mod_http_xslt_filter
456%module_scripts mod_mail
457%module_scripts mod_vts
458%module_scripts mod_stream
459%module_scripts mod_stream_geoip
460
461%files
462%defattr(644,root,root,755)
463%doc CHANGES LICENSE README html/index.html conf/nginx.conf
464%doc %lang(ru) CHANGES.ru
465%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
466%attr(754,root,root) /etc/rc.d/init.d/%{name}
467%dir %attr(750,root,nginx) %{_sysconfdir}
468%dir %{_sysconfdir}/conf.d
469%dir %{_sysconfdir}/modules.d
470%dir %{_sysconfdir}/snippets
471%dir %{_sysconfdir}/vhosts.d
472%dir %{_sysconfdir}/webapps.d
473%attr(640,root,root) %{_sysconfdir}/mime.types
474%attr(640,root,root) %{_sysconfdir}/koi-utf
475%attr(640,root,root) %{_sysconfdir}/koi-win
476%attr(640,root,root) %{_sysconfdir}/win-utf
477%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fastcgi.conf
478%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nginx.conf
479%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/proxy.conf
480%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fastcgi_params
481%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/scgi_params
482%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/uwsgi_params
483%attr(755,root,root) %{_sbindir}/%{name}
484%dir %{_libdir}/%{name}
485%dir %{_libdir}/%{name}/modules
486%{systemdunitdir}/%{name}.service
487
488%attr(750,nginx,logs) %dir /var/log/archive/%{name}
489%attr(750,nginx,logs) /var/log/%{name}
490%attr(770,root,nginx) /var/cache/%{name}
491
492%dir %{_nginxdir}
493%dir %{_nginxdir}/cgi-bin
494%dir %{_nginxdir}/html
495%dir %{_nginxdir}/errors
496%config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
497%config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
498
499%if %{with geoip}
500%files mod_http_geoip
501%defattr(644,root,root,755)
502%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_geoip.conf
503%attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_geoip_module.so
504
505%files mod_stream_geoip
506%defattr(644,root,root,755)
507%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_stream_geoip.conf
508%attr(755,root,root) %{_libdir}/%{name}/modules/ngx_stream_geoip_module.so
509%endif
510
511%if %{with gd}
512%files mod_http_image_filter
513%defattr(644,root,root,755)
514%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_image_filter.conf
515%attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_image_filter_module.so
516%endif
517
518%if %{with perl}
519%files mod_http_perl
520%defattr(644,root,root,755)
521%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_perl.conf
522%attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_perl_module.so
523%dir %{perl_vendorarch}/auto/%{name}
524%attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so
525%{perl_vendorarch}/%{name}.pm
526%{_mandir}/man3/nginx.3pm*
527%endif
528
529%if %{with xslt}
530%files mod_http_xslt_filter
531%defattr(644,root,root,755)
532%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_xslt_filter.conf
533%attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_xslt_filter_module.so
534%endif
535
536%if %{with mail}
537%files mod_mail
538%defattr(644,root,root,755)
539%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_mail.conf
540%attr(755,root,root) %{_libdir}/%{name}/modules/ngx_mail_module.so
541%endif
542
543%if %{with vts}
544%files mod_vts
545%defattr(644,root,root,755)
546%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_vhost_traffic_status.conf
547%attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_vhost_traffic_status_module.so
548%endif
549
550%if %{with stream}
551%files mod_stream
552%defattr(644,root,root,755)
553%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_stream.conf
554%attr(755,root,root) %{_libdir}/%{name}/modules/ngx_stream_module.so
555%endif
556
557%files -n monit-rc-nginx
558%defattr(644,root,root,755)
559%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc
This page took 0.066272 seconds and 4 git commands to generate.