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