2 # - /etc/sysconfig/nginx file
3 # - missing perl build/install requires
4 # - prepare pld style like nginx.conf
6 # Conditional build for nginx:
7 %bcond_without light # don't build light version
8 %bcond_without mail # don't build imap/mail proxy
9 %bcond_without perl # don't build with perl module
10 %bcond_without addition # adds module
11 %bcond_without dav # WebDAV
12 %bcond_without flv # FLV stream
13 %bcond_without sub # ngx_http_sub_module
14 %bcond_without poll # poll
15 %bcond_without realip # real ip (behind proxy)
16 %bcond_without rtsig # rtsig
17 %bcond_without select # select
18 %bcond_without status # stats module
19 %bcond_without ssl # ssl support
20 %bcond_with http_browser # header "User-agent" parser
22 Summary: High perfomance HTTP and reverse proxy server
23 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
28 Group: Networking/Daemons
29 Source0: http://sysoev.ru/nginx/%{name}-%{version}.tar.gz
30 # Source0-md5: a78be74b4fd8e009545ef02488fcac86
32 Source2: %{name}-mime.types.sh
33 Source3: http://www.nginx.eu/favicon.ico
34 # Source3-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab
35 Source4: http://www.nginx.eu/download/proxy.conf
36 # Source4-md5: f5263ae01c2edb18f46d5d1df2d3a5cd
37 Source5: http://www.nginx.eu/download/%{name}.monitrc
38 # Source5-md5: 1d3f5eedfd34fe95213f9e0fc19daa88
39 Source6: http://www.nginx.eu/download/%{name}.conf
40 # Source6-md5: 1c112d6f03d0f365e4acc98c1d96261a
41 Source7: %{name}.logrotate
42 Patch0: %{name}-config.patch
43 URL: http://nginx.net/
44 BuildRequires: mailcap
45 BuildRequires: openssl-devel
46 BuildRequires: pcre-devel
47 %{?with_perl:BuildRequires: perl-CGI}
48 %{?with_perl:BuildRequires: perl-devel}
49 %{?with_perl:BuildRequires: rpm-perlprov}
50 BuildRequires: rpmbuild(macros) >= 1.268
51 BuildRequires: zlib-devel
52 Requires(post,preun): /sbin/chkconfig
53 Requires(postun): /usr/sbin/groupdel
54 Requires(postun): /usr/sbin/userdel
55 Requires(pre): /bin/id
56 Requires(pre): /usr/bin/getgid
57 Requires(pre): /usr/sbin/groupadd
58 Requires(pre): /usr/sbin/useradd
62 Requires: rc-scripts >= 0.2.0
65 Provides: group(nginx)
68 #Conflicts: %{name}-light
69 #Conflicts: %{name}-mail
70 #Conflicts: %{name}-perl
71 #Conflicts: logrotate < 3.7-4
72 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
74 %define _sysconfdir /etc/%{name}
75 %define _nginxdir /home/services/%{name}
78 Nginx ("engine x") is a high-performance HTTP server and reverse
79 proxy, as well as an IMAP/POP3 proxy server. Nginx was written by Igor
80 Sysoev for Rambler.ru, Russia's second-most visited website, where it
81 has been running in production for over two and a half years. Igor has
82 released the source code under a BSD-like license. Although still in
83 beta, Nginx is known for its stability, rich feature set, simple
84 configuration, and low resource consumption.
86 Common files for Nginx daemon.
88 %description -l pl.UTF-8
89 Nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
90 a także IMAP/POP3 proxy. Nginx został napisany przez Igora Sysoev'a
91 na potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
92 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
93 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle
94 w fazie beta, już zasÅynÄÅ dzieki stabilnoÅi, bogactwu dodatków,
95 prostej konfiguracji oraz maÅej "zasobożernoÅi".
97 Niezb¿dne pliki dla Nginx.
100 Summary: High perfomance HTTP and reverse proxy server
101 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
103 Group: Networking/Daemons
104 URL: http://nginx.net/
105 Requires(post,preun): /sbin/chkconfig
106 Requires(postun): /usr/sbin/groupdel
107 Requires(postun): /usr/sbin/userdel
108 Requires: %{name} = %{version}-%{release}
112 Provides: group(http)
113 Provides: group(nginx)
114 Provides: user(nginx)
117 #Conflicts: %{name}-mail
118 #Conflicts: %{name}-perl
121 The smallest, but also the fastest Nginx edition. No additional
122 modules, no Perl, no DAV, no FLV, no IMAP, POP3, SMTP proxy.
124 %description light -l pl.UTF-8
125 Najmniejsza i najszybsza wersja Nginx. Bez wsparcia dla Perla,
126 DAV, FLV oraz IMAP, POP3, SMTP proxy.
129 Summary: High perfomance HTTP and reverse proxy server
130 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
132 Group: Networking/Daemons
133 URL: http://nginx.net/
134 Requires(post,preun): /sbin/chkconfig
135 Requires(postun): /usr/sbin/groupdel
136 Requires(postun): /usr/sbin/userdel
137 Requires: %{name} = %{version}-%{release}
139 Provides: group(http)
140 Provides: group(nginx)
141 Provides: user(nginx)
144 #Conflicts: %{name}-light
145 #Conflicts: %{name}-mail
148 Nginx with Perl support. Mail modules not included.
150 %description perl -l pl.UTF-8
151 Nignx z obsługą Perla. Bez wsparcia dla modułów poczty.
154 Summary: High perfomance HTTP and reverse proxy server
155 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
157 Group: Networking/Daemons
158 URL: http://nginx.net/
159 Requires(post,preun): /sbin/chkconfig
160 Requires(postun): /usr/sbin/groupdel
161 Requires(postun): /usr/sbin/userdel
162 Requires: %{name} = %{version}-%{release}
166 Provides: group(http)
167 Provides: group(nginx)
168 Provides: user(nginx)
171 #Conflicts: %{name}-light
172 #Conflicts: %{name}-perl
175 Nginx with mail support. Only mail modules included.
177 %description mail -l pl.UTF-8
178 Nginx ze wsparciem tylko dla modułów poczty.
181 Summary: Configuration files and documentation for Nginx
182 Summary(pl.UTF-8): Pliki konfiguracyjne i dokumentacja dla Nginx
184 Group: Networking/Daemons
185 URL: http://nginx.net/
186 Requires(post,preun): /sbin/chkconfig
187 Requires(postun): /usr/sbin/groupdel
188 Requires(postun): /usr/sbin/userdel
189 Requires: %{name} = %{version}-%{release}
190 Conflicts: logrotate < 3.7-4
192 %description standard
193 Nginx ("engine x") is a high-performance HTTP server and reverse
194 proxy, as well as an IMAP/POP3 proxy server. Nginx was written by Igor
195 Sysoev for Rambler.ru, Russia's second-most visited website, where it
196 has been running in production for over two and a half years. Igor has
197 released the source code under a BSD-like license. Although still in
198 beta, Nginx is known for its stability, rich feature set, simple
199 configuration, and low resource consumption.
201 This is standard nginx version, without perl support and imap, pop3,
204 %description standard -l pl.UTF-8
205 Nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
206 a także IMAP/POP3 proxy. Nginx został napisany przez Igora Sysoev'a
207 na potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
208 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
209 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle
210 w fazie beta, już zasÅynÄÅ dzieki stabilnoÅi, bogactwu dodatków,
211 prostej konfiguracji oraz maÅej "zasobożernoÅi".
213 To jest standardowa wersja nginx, bez obs?ugi perla oraz proxy dla
216 %package -n monit-rc-nginx
217 Summary: Nginx support for monit
218 Summary(pl.UTF-8): Wsparcie Nginx dla monit
220 Group: Applications/System
221 URL: http://nginx.eu/
222 Requires: %{name} = %{version}-%{release}
223 Provides: group(http)
224 Provides: group(nginx)
225 Provides: user(nginx)
228 %description -n monit-rc-nginx
229 monitrc file for monitoring Nginx webserver server.
231 %description -n monit-rc-nginx -l pl.UTF-8
232 Plik monitrc do monitorowania serwera WWW Nginx.
238 # build mime.types.conf
239 sh %{SOURCE2} /etc/mime.types
242 # NB: not autoconf generated configure
243 cp -f configure auto/
247 --prefix=%{_prefix} \
248 --sbin-path=%{_sbindir}/%{name}-perl \
249 --conf-path=%{_sysconfdir}/%{name}-perl.conf \
250 --error-log-path=%{_localstatedir}/log/%{name}/%{name}-perl_error.log \
251 --http-log-path=%{_localstatedir}/log/%{name}/%{name}-perl_access.log \
252 --pid-path=%{_localstatedir}/run/%{name}-perl.pid \
253 --lock-path=%{_localstatedir}/lock/subsys/%{name}-perl \
256 --with-http_perl_module \
257 --without-mail_pop3_module \
258 --without-mail_imap_module \
259 --without-mail_smtp_module \
260 %{?with_addition:--with-http_addition_module} \
261 %{?with_dav:--with-http_dav_module} \
262 %{?with_flv:--with-http_flv_module} \
263 %{?with_sub:--with-http_sub_module} \
264 %{?with_poll:--with-poll_module} \
265 %{?with_realip:--with-http_realip_module} \
266 %{?with_rtsig:--with-rtsig_module} \
267 %{?with_select:--with-select_module} \
268 %{?with_status:--with-http_stub_status_module} \
269 %{?with_ssl:--with-http_ssl_module} \
270 %{!?with_http_browser:--without-http_browser_module} \
271 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-perl/client_body_temp \
272 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-perl/proxy_temp \
273 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-perl/fastcgi_temp \
274 --with-cc="%{__cc}" \
275 --with-cc-opt="%{rpmcflags}" \
276 --with-ld-opt="%{rpmldflags}"
278 mv -f objs/nginx contrib/nginx-perl
279 mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.bs contrib/nginx.bs
280 mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so contrib/nginx.so
281 mv -f objs/src/http/modules/perl/nginx.pm contrib/nginx.pm
287 --prefix=%{_prefix} \
288 --sbin-path=%{_sbindir}/%{name}-mail \
289 --conf-path=%{_sysconfdir}/%{name}-mail.conf \
290 --error-log-path=%{_localstatedir}/log/%{name}/%{name}-mail_error.log \
291 --http-log-path=%{_localstatedir}/log/%{name}/%{name}-mail_access.log \
292 --pid-path=%{_localstatedir}/run/%{name}-mail.pid \
293 --lock-path=%{_localstatedir}/lock/subsys/%{name}-mail \
298 --with-mail_ssl_module \
300 %{?with_poll:--with-poll_module} \
301 %{?with_rtsig:--with-rtsig_module} \
302 %{?with_select:--with-select_module} \
303 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-mail/client_body_temp \
304 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-mail/proxy_temp \
305 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-mail/fastcgi_temp \
306 --with-cc="%{__cc}" \
307 --with-cc-opt="%{rpmcflags}" \
308 --with-ld-opt="%{rpmldflags}" \
309 %{?debug:--with-debug}
311 mv -f objs/nginx contrib/nginx-mail
317 --prefix=%{_prefix} \
318 --sbin-path=%{_sbindir}/%{name}-light \
319 --conf-path=%{_sysconfdir}/%{name}-light.conf \
320 --error-log-path=%{_localstatedir}/log/%{name}/%{name}-light_error.log \
321 --http-log-path=%{_localstatedir}/log/%{name}/%{name}-light_access.log \
322 --pid-path=%{_localstatedir}/run/%{name}-light.pid \
323 --lock-path=%{_localstatedir}/lock/subsys/%{name}-light \
326 %{?with_poll:--with-poll_module} \
327 %{?with_realip:--with-http_realip_module} \
328 %{?with_rtsig:--with-rtsig_module} \
329 %{?with_select:--with-select_module} \
330 %{?with_status:--with-http_stub_status_module} \
331 %{?with_ssl:--with-http_ssl_module} \
332 --without-http_browser_module \
333 --without-mail_pop3_module \
334 --without-mail_imap_module \
335 --without-mail_smtp_module \
336 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-light/client_body_temp \
337 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-light/proxy_temp \
338 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-light/fastcgi_temp \
339 --with-cc="%{__cc}" \
340 --with-cc-opt="%{rpmcflags}" \
341 --with-ld-opt="%{rpmldflags}" \
342 %{?debug:--with-debug}
344 mv -f objs/nginx contrib/nginx-light
349 --prefix=%{_prefix} \
350 --sbin-path=%{_sbindir}/%{name} \
351 --conf-path=%{_sysconfdir}/%{name}.conf \
352 --error-log-path=%{_localstatedir}/log/%{name}/%{name}_error.log \
353 --http-log-path=%{_localstatedir}/log/%{name}/%{name}_access.log \
354 --pid-path=%{_localstatedir}/run/%{name}.pid \
355 --lock-path=%{_localstatedir}/lock/subsys/%{name} \
358 %{?with_addition:--with-http_addition_module} \
359 %{?with_dav:--with-http_dav_module} \
360 %{?with_flv:--with-http_flv_module} \
361 %{?with_sub:--with-http_sub_module} \
362 %{?with_poll:--with-poll_module} \
363 %{?with_realip:--with-http_realip_module} \
364 %{?with_rtsig:--with-rtsig_module} \
365 %{?with_select:--with-select_module} \
366 %{?with_status:--with-http_stub_status_module} \
367 %{?with_ssl:--with-http_ssl_module} \
368 %{!?with_http_browser:--without-http_browser_module} \
369 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
370 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
371 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
372 --with-cc="%{__cc}" \
373 --with-cc-opt="%{rpmcflags}" \
374 --with-ld-opt="%{rpmldflags}" \
375 %{?debug:--with-debug}
380 rm -rf $RPM_BUILD_ROOT
381 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
382 $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
383 $RPM_BUILD_ROOT%{_localstatedir}/log/{%{name},archive/%{name}} \
384 $RPM_BUILD_ROOT%{_localstatedir}/cache/{%{name},%{name}-perl,%{name}-mail,%{name}-light} \
385 $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/%{name} \
386 $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}} \
387 $RPM_BUILD_ROOT/etc/{logrotate.d,monit}
389 install conf/* $RPM_BUILD_ROOT%{_sysconfdir}
390 install mime.types $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
391 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
392 install %{SOURCE3} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
393 install html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
394 install html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
395 install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
396 install %{SOURCE5} $RPM_BUILD_ROOT/etc/monit/%{name}.monitrc
397 install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/nginx.conf
398 install %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
399 install objs/%{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}-standard
402 install contrib/nginx-light $RPM_BUILD_ROOT%{_sbindir}/%{name}-light
406 install contrib/nginx-mail $RPM_BUILD_ROOT%{_sbindir}/%{name}-mail
410 install -d $RPM_BUILD_ROOT{%{perl_vendorarch},%{perl_vendorarch}/auto/%{name}}
411 install contrib/nginx.pm $RPM_BUILD_ROOT%{perl_vendorarch}/%{name}.pm
412 install contrib/nginx.so $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.so
413 install contrib/nginx.bs $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.bs
414 install contrib/nginx-perl $RPM_BUILD_ROOT%{_sbindir}/%{name}-perl
417 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.default
418 rm -rf $RPM_BUILD_ROOT%{_prefix}/html
421 rm -rf $RPM_BUILD_ROOT
424 %groupadd -r -g 213 %{name}
426 %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
427 %addusertogroup %{name} http
430 for a in access.log error.log; do
431 if [ ! -f /var/log/%{name}/$a ]; then
432 touch /var/log/%{name}/$a
433 chown nginx:nginx /var/log/%{name}/$a
434 chmod 644 /var/log/%{name}/$a
439 /sbin/chkconfig --add %{name}
440 %service %{name} restart
443 /sbin/chkconfig --add %{name}
444 %service %{name} restart
447 /sbin/chkconfig --add %{name}
448 %service %{name} restart
451 /sbin/chkconfig --add %{name}
452 %service %{name} restart
455 if [ "$1" = "0" ]; then
456 %service -q %{name} stop
457 /sbin/chkconfig --del %{name}
461 if [ "$1" = "0" ]; then
462 %service -q %{name} stop
463 /sbin/chkconfig --del %{name}
467 if [ "$1" = "0" ]; then
468 %service -q %{name} stop
469 /sbin/chkconfig --del %{name}
473 if [ "$1" = "0" ]; then
474 %service -q %{name} stop
475 /sbin/chkconfig --del %{name}
479 if [ "$1" = "0" ]; then
485 %defattr(644,root,root,755)
486 %doc CHANGES LICENSE README html/index.html conf/nginx.conf
487 %doc %lang(ru) CHANGES.ru
488 %attr(754,root,root) /etc/rc.d/init.d/%{name}
489 %dir %attr(754,root,root) %{_sysconfdir}
491 %dir %{_nginxdir}/cgi-bin
492 %dir %{_nginxdir}/html
493 %dir %{_nginxdir}/errors
494 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
495 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
496 %attr(640,root,root) %{_sysconfdir}/*[_-]*
497 %attr(640,root,root) %{_sysconfdir}/proxy.conf
498 %attr(640,root,root) %{_sysconfdir}/mime.types
499 %attr(770,root,%{name}) /var/cache/%{name}
500 %attr(750,root,root) %dir /var/log/archive/%{name}
501 %attr(750,%{name},logs) /var/log/%{name}
502 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
503 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
506 %defattr(644,root,root,755)
507 %attr(755,root,root) %{_sbindir}/%{name}-standard
511 %defattr(644,root,root,755)
512 %attr(755,root,root) %{_sbindir}/%{name}-mail
517 %defattr(644,root,root,755)
518 %attr(755,root,root) %{_sbindir}/%{name}-light
523 %defattr(644,root,root,755)
524 %attr(755,root,root) %{_sbindir}/%{name}-perl
525 %dir %{perl_vendorarch}/auto/%{name}
526 %attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so
527 %attr(700,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.bs
528 %attr(700,root,root) %{perl_vendorarch}/%{name}.pm
531 %files -n monit-rc-nginx
532 %defattr(644,root,root,755)
533 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc