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