2 # - /etc/sysconfig/nginx file
3 # - missing perl build/install requires
4 # - prepare pld style like nginx.conf
5 # - maybe -with-cpu-opt=CPU (pentium, pentiumpro, pentium3, pentium4, athlon, opteron, amd64, sparc32, sparc64, ppc64)
7 # Conditional build for nginx:
8 %bcond_without light # don't build light version
9 %bcond_without mail # don't build imap/mail proxy
10 %bcond_without perl # don't build with perl module
11 %bcond_without addition # adds module
12 %bcond_without dav # WebDAV
13 %bcond_without flv # FLV stream
14 %bcond_without sub # ngx_http_sub_module
15 %bcond_without poll # poll
16 %bcond_without realip # real ip (behind proxy)
17 %bcond_without rtsig # rtsig
18 %bcond_without select # select
19 %bcond_without status # stats module
20 %bcond_without ssl # ssl support
21 %bcond_with http_browser # header "User-agent" parser
23 Summary: High perfomance HTTP and reverse proxy server
24 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
29 Group: Networking/Daemons
30 Source0: http://sysoev.ru/nginx/%{name}-%{version}.tar.gz
31 # Source0-md5: a78be74b4fd8e009545ef02488fcac86
32 Source1: http://www.nginx.eu/favicon.ico
33 # Source1-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab
34 Source2: http://www.nginx.eu/download/proxy.conf
35 # Source2-md5: f5263ae01c2edb18f46d5d1df2d3a5cd
36 Source3: %{name}.logrotate
38 Source5: %{name}-light.conf
39 Source6: %{name}-light.monitrc
40 Source7: %{name}-mail.conf
41 Source8: %{name}-mail.monitrc
42 Source9: %{name}-perl.conf
43 Source10: %{name}-perl.monitrc
44 Source11: %{name}-standard.conf
45 Source12: %{name}-standard.monitrc
46 Source13: %{name}-mime.types.sh
47 Patch0: %{name}-config.patch
48 URL: http://nginx.net/
49 BuildRequires: mailcap
50 BuildRequires: openssl-devel
51 BuildRequires: pcre-devel
52 %{?with_perl:BuildRequires: perl-CGI}
53 %{?with_perl:BuildRequires: perl-devel}
54 %{?with_perl:BuildRequires: rpm-perlprov}
55 BuildRequires: rpmbuild(macros) >= 1.268
56 BuildRequires: zlib-devel
57 Requires(post,preun): /sbin/chkconfig
58 Requires(postun): /usr/sbin/groupdel
59 Requires(postun): /usr/sbin/userdel
60 Requires(pre): /bin/id
61 Requires(pre): /usr/bin/getgid
62 Requires(pre): /usr/sbin/groupadd
63 Requires(pre): /usr/sbin/useradd
67 Requires: rc-scripts >= 0.2.0
70 Provides: group(nginx)
73 Conflicts: logrotate < 3.7-4
74 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
76 %define _sysconfdir /etc/%{name}
77 %define _nginxdir /home/services/%{name}
80 Nginx ("engine x") is a high-performance HTTP server and reverse
81 proxy, as well as an IMAP/POP3 proxy server. Nginx was written by Igor
82 Sysoev for Rambler.ru, Russia's second-most visited website, where it
83 has been running in production for over two and a half years. Igor has
84 released the source code under a BSD-like license. Although still in
85 beta, Nginx is known for its stability, rich feature set, simple
86 configuration, and low resource consumption.
88 Common files for Nginx daemon.
90 %description -l pl.UTF-8
91 Nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
92 a także IMAP/POP3 proxy. Nginx został napisany przez Igora Sysoev'a
93 na potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
94 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
95 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle
96 w fazie beta, już zasÅynÄÅ dzieki stabilnoÅi, bogactwu dodatków,
97 prostej konfiguracji oraz maÅej "zasobożernoÅi".
99 Niezb¿dne pliki dla Nginx.
102 Summary: High perfomance HTTP and reverse proxy server
103 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
105 Group: Networking/Daemons
106 URL: http://nginx.net/
107 Requires(post,preun): /sbin/chkconfig
108 Requires(postun): /usr/sbin/groupdel
109 Requires(postun): /usr/sbin/userdel
110 Requires: %{name} = %{version}-%{release}
114 Provides: group(http)
115 Provides: group(nginx)
116 Provides: user(nginx)
119 #Conflicts: %{name}-mail
120 #Conflicts: %{name}-perl
123 The smallest, but also the fastest Nginx edition. No additional
124 modules, no Perl, no DAV, no FLV, no IMAP, POP3, SMTP proxy.
126 %description light -l pl.UTF-8
127 Najmniejsza i najszybsza wersja Nginx. Bez wsparcia dla Perla,
128 DAV, FLV oraz IMAP, POP3, SMTP proxy.
131 Summary: High perfomance HTTP and reverse proxy server
132 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
134 Group: Networking/Daemons
135 URL: http://nginx.net/
136 Requires(post,preun): /sbin/chkconfig
137 Requires(postun): /usr/sbin/groupdel
138 Requires(postun): /usr/sbin/userdel
139 Requires: %{name} = %{version}-%{release}
141 Provides: group(http)
142 Provides: group(nginx)
143 Provides: user(nginx)
146 #Conflicts: %{name}-light
147 #Conflicts: %{name}-mail
150 Nginx with Perl support. Mail modules not included.
152 %description perl -l pl.UTF-8
153 Nignx z obsługą Perla. Bez wsparcia dla modułów poczty.
156 Summary: High perfomance HTTP and reverse proxy server
157 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
159 Group: Networking/Daemons
160 URL: http://nginx.net/
161 Requires(post,preun): /sbin/chkconfig
162 Requires(postun): /usr/sbin/groupdel
163 Requires(postun): /usr/sbin/userdel
164 Requires: %{name} = %{version}-%{release}
168 Provides: group(http)
169 Provides: group(nginx)
170 Provides: user(nginx)
173 #Conflicts: %{name}-light
174 #Conflicts: %{name}-perl
177 Nginx with mail support. Only mail modules included.
179 %description mail -l pl.UTF-8
180 Nginx ze wsparciem tylko dla modułów poczty.
183 Summary: Configuration files and documentation for Nginx
184 Summary(pl.UTF-8): Pliki konfiguracyjne i dokumentacja dla Nginx
186 Group: Networking/Daemons
187 URL: http://nginx.net/
188 Requires(post,preun): /sbin/chkconfig
189 Requires(postun): /usr/sbin/groupdel
190 Requires(postun): /usr/sbin/userdel
191 Requires: %{name} = %{version}-%{release}
192 Conflicts: logrotate < 3.7-4
194 %description standard
195 Nginx ("engine x") is a high-performance HTTP server and reverse
196 proxy, as well as an IMAP/POP3 proxy server. Nginx was written by Igor
197 Sysoev for Rambler.ru, Russia's second-most visited website, where it
198 has been running in production for over two and a half years. Igor has
199 released the source code under a BSD-like license. Although still in
200 beta, Nginx is known for its stability, rich feature set, simple
201 configuration, and low resource consumption.
203 This is standard nginx version, without perl support and imap, pop3,
206 %description standard -l pl.UTF-8
207 Nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
208 a także IMAP/POP3 proxy. Nginx został napisany przez Igora Sysoev'a
209 na potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
210 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
211 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle
212 w fazie beta, już zasÅynÄÅ dzieki stabilnoÅi, bogactwu dodatków,
213 prostej konfiguracji oraz maÅej "zasobożernoÅi".
215 To jest standardowa wersja nginx, bez obs?ugi perla oraz proxy dla
222 # build mime.types.conf
223 #sh %{SOURCE13} /etc/mime.types
226 # NB: not autoconf generated configure
227 cp -f configure auto/
231 --prefix=%{_prefix} \
232 --sbin-path=%{_sbindir}/%{name}-perl \
233 --conf-path=%{_sysconfdir}/%{name}-perl.conf \
234 --error-log-path=%{_localstatedir}/log/%{name}/%{name}-perl_error.log \
235 --http-log-path=%{_localstatedir}/log/%{name}/%{name}-perl_access.log \
236 --pid-path=%{_localstatedir}/run/%{name}-perl.pid \
237 --lock-path=%{_localstatedir}/lock/subsys/%{name}-perl \
240 --with-http_perl_module \
241 --without-mail_pop3_module \
242 --without-mail_imap_module \
243 --without-mail_smtp_module \
244 %{?with_addition:--with-http_addition_module} \
245 %{?with_dav:--with-http_dav_module} \
246 %{?with_flv:--with-http_flv_module} \
247 %{?with_sub:--with-http_sub_module} \
248 %{?with_poll:--with-poll_module} \
249 %{?with_realip:--with-http_realip_module} \
250 %{?with_rtsig:--with-rtsig_module} \
251 %{?with_select:--with-select_module} \
252 %{?with_status:--with-http_stub_status_module} \
253 %{?with_ssl:--with-http_ssl_module} \
254 %{!?with_http_browser:--without-http_browser_module} \
255 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-perl/client_body_temp \
256 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-perl/proxy_temp \
257 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-perl/fastcgi_temp \
258 --with-cc="%{__cc}" \
259 --with-cc-opt="%{rpmcflags}" \
260 --with-ld-opt="%{rpmldflags}"
262 mv -f objs/nginx contrib/nginx-perl
263 mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.bs contrib/nginx.bs
264 mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so contrib/nginx.so
265 mv -f objs/src/http/modules/perl/nginx.pm contrib/nginx.pm
271 --prefix=%{_prefix} \
272 --sbin-path=%{_sbindir}/%{name}-mail \
273 --conf-path=%{_sysconfdir}/%{name}-mail.conf \
274 --error-log-path=%{_localstatedir}/log/%{name}/%{name}-mail_error.log \
275 --http-log-path=%{_localstatedir}/log/%{name}/%{name}-mail_access.log \
276 --pid-path=%{_localstatedir}/run/%{name}-mail.pid \
277 --lock-path=%{_localstatedir}/lock/subsys/%{name}-mail \
282 --with-mail_ssl_module \
284 %{?with_poll:--with-poll_module} \
285 %{?with_rtsig:--with-rtsig_module} \
286 %{?with_select:--with-select_module} \
287 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-mail/client_body_temp \
288 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-mail/proxy_temp \
289 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-mail/fastcgi_temp \
290 --with-cc="%{__cc}" \
291 --with-cc-opt="%{rpmcflags}" \
292 --with-ld-opt="%{rpmldflags}" \
293 %{?debug:--with-debug}
295 mv -f objs/nginx contrib/nginx-mail
301 --prefix=%{_prefix} \
302 --sbin-path=%{_sbindir}/%{name}-light \
303 --conf-path=%{_sysconfdir}/%{name}-light.conf \
304 --error-log-path=%{_localstatedir}/log/%{name}/%{name}-light_error.log \
305 --http-log-path=%{_localstatedir}/log/%{name}/%{name}-light_access.log \
306 --pid-path=%{_localstatedir}/run/%{name}-light.pid \
307 --lock-path=%{_localstatedir}/lock/subsys/%{name}-light \
310 %{?with_poll:--with-poll_module} \
311 %{?with_realip:--with-http_realip_module} \
312 %{?with_rtsig:--with-rtsig_module} \
313 %{?with_select:--with-select_module} \
314 %{?with_status:--with-http_stub_status_module} \
315 %{?with_ssl:--with-http_ssl_module} \
316 --without-http_browser_module \
317 --without-mail_pop3_module \
318 --without-mail_imap_module \
319 --without-mail_smtp_module \
320 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-light/client_body_temp \
321 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-light/proxy_temp \
322 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-light/fastcgi_temp \
323 --with-cc="%{__cc}" \
324 --with-cc-opt="%{rpmcflags}" \
325 --with-ld-opt="%{rpmldflags}" \
326 %{?debug:--with-debug}
328 mv -f objs/nginx contrib/nginx-light
333 --prefix=%{_prefix} \
334 --sbin-path=%{_sbindir}/%{name}-standard \
335 --conf-path=%{_sysconfdir}/%{name}.conf \
336 --error-log-path=%{_localstatedir}/log/%{name}/%{name}-standard_error.log \
337 --http-log-path=%{_localstatedir}/log/%{name}/%{name}-standard_access.log \
338 --pid-path=%{_localstatedir}/run/%{name}-standard.pid \
339 --lock-path=%{_localstatedir}/lock/subsys/%{name}-standard \
342 %{?with_addition:--with-http_addition_module} \
343 %{?with_dav:--with-http_dav_module} \
344 %{?with_flv:--with-http_flv_module} \
345 %{?with_sub:--with-http_sub_module} \
346 %{?with_poll:--with-poll_module} \
347 %{?with_realip:--with-http_realip_module} \
348 %{?with_rtsig:--with-rtsig_module} \
349 %{?with_select:--with-select_module} \
350 %{?with_status:--with-http_stub_status_module} \
351 %{?with_ssl:--with-http_ssl_module} \
352 %{!?with_http_browser:--without-http_browser_module} \
353 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-standard/client_body_temp \
354 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-standard/proxy_temp \
355 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-standard/fastcgi_temp \
356 --with-cc="%{__cc}" \
357 --with-cc-opt="%{rpmcflags}" \
358 --with-ld-opt="%{rpmldflags}" \
359 %{?debug:--with-debug}
364 rm -rf $RPM_BUILD_ROOT
365 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
366 $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
367 $RPM_BUILD_ROOT%{_localstatedir}/log/{%{name},archive/%{name}} \
368 $RPM_BUILD_ROOT%{_localstatedir}/cache/{%{name}-standard,%{name}-perl,%{name}-mail,%{name}-light} \
369 $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/{%{name}-standard,%{name}-perl,%{name}-mail,%{name}-light} \
370 $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}} \
371 $RPM_BUILD_ROOT/etc/{logrotate.d,monit}
373 #install conf/* $RPM_BUILD_ROOT%{_sysconfdir}
374 install html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
375 install html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
376 install %{SOURCE1} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
377 install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
378 install %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
379 install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
380 install %{SOURCE11} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-standard.conf
381 install %{SOURCE12} $RPM_BUILD_ROOT/etc/monit/%{name}-standard.monitrc
382 install objs/%{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}-standard
383 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-standard
386 install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-light.conf
387 install %{SOURCE6} $RPM_BUILD_ROOT/etc/monit/%{name}-light.monitrc
388 install contrib/nginx-light $RPM_BUILD_ROOT%{_sbindir}/%{name}-light
392 install %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-mail.conf
393 install %{SOURCE8} $RPM_BUILD_ROOT/etc/monit/%{name}-mail.monitrc
394 install contrib/nginx-mail $RPM_BUILD_ROOT%{_sbindir}/%{name}-mail
398 install -d $RPM_BUILD_ROOT{%{perl_vendorarch},%{perl_vendorarch}/auto/%{name}}
399 install %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-perl.conf
400 install %{SOURCE8} $RPM_BUILD_ROOT/etc/monit/%{name}-perl.monitrc
401 install contrib/nginx.pm $RPM_BUILD_ROOT%{perl_vendorarch}/%{name}.pm
402 install contrib/nginx.so $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.so
403 install contrib/nginx.bs $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.bs
404 install contrib/nginx-perl $RPM_BUILD_ROOT%{_sbindir}/%{name}-perl
407 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.default
408 rm -rf $RPM_BUILD_ROOT%{_prefix}/html
411 rm -rf $RPM_BUILD_ROOT
414 %groupadd -r -g 213 %{name}
416 %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
417 %addusertogroup %{name} http
420 for a in access.log error.log; do
421 if [ ! -f /var/log/%{name}/nginx-standard_$a ]; then
422 touch /var/log/%{name}/nginx-standard_$a
423 chown nginx:nginx /var/log/%{name}/nginx-standard_$a
424 chmod 644 /var/log/%{name}/nginx-standard_$a
429 for a in access.log error.log; do
430 if [ ! -f /var/log/%{name}/nginx-light_$a ]; then
431 touch /var/log/%{name}/nginx-light_$a
432 chown nginx:nginx /var/log/%{name}/nginx-light_$a
433 chmod 644 /var/log/%{name}/nginx-light_$a
438 for a in access.log error.log; do
439 if [ ! -f /var/log/%{name}/nginx-perl_$a ]; then
440 touch /var/log/%{name}/nginx-perl_$a
441 chown nginx:nginx /var/log/%{name}/nginx-perl_$a
442 chmod 644 /var/log/%{name}/nginx-perl_$a
447 for a in access.log error.log; do
448 if [ ! -f /var/log/%{name}/nginx-mail_$a ]; then
449 touch /var/log/%{name}/nginx-mail_$a
450 chown nginx:nginx /var/log/%{name}/nginx-mail_$a
451 chmod 644 /var/log/%{name}/nginx-mail_$a
456 /sbin/chkconfig --add %{name}-standard
457 %service %{name}-standard restart
460 /sbin/chkconfig --add %{name}-light
461 %service %{name}-light restart
464 /sbin/chkconfig --add %{name}-perl
465 %service %{name}-perl restart
468 /sbin/chkconfig --add %{name}-mail
469 %service %{name}-mail restart
472 if [ "$1" = "0" ]; then
473 %service -q %{name}-standard stop
474 /sbin/chkconfig --del %{name}-standard
478 if [ "$1" = "0" ]; then
479 %service -q %{name}-light stop
480 /sbin/chkconfig --del %{name}-light
484 if [ "$1" = "0" ]; then
485 %service -q %{name}-perl stop
486 /sbin/chkconfig --del %{name}-perl
490 if [ "$1" = "0" ]; then
491 %service -q %{name}-mail stop
492 /sbin/chkconfig --del %{name}-mail
496 if [ "$1" = "0" ]; then
502 %defattr(644,root,root,755)
503 %doc CHANGES LICENSE README html/index.html conf/nginx.conf
504 %doc %lang(ru) CHANGES.ru
505 %dir %attr(754,root,root) %{_sysconfdir}
507 %dir %{_nginxdir}/cgi-bin
508 %dir %{_nginxdir}/html
509 %dir %{_nginxdir}/errors
510 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
511 %attr(640,root,root) %{_sysconfdir}/*[_-]*
512 %attr(640,root,root) %{_sysconfdir}/proxy.conf
513 %attr(640,root,root) %{_sysconfdir}/mime.types
514 %attr(750,root,root) %dir /var/log/archive/%{name}
515 %attr(750,%{name},logs) /var/log/%{name}
516 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
517 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
520 %defattr(644,root,root,755)
521 %attr(755,root,root) %{_sbindir}/%{name}-standard
522 %attr(770,root,%{name}) /var/cache/%{name}-standard
523 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-standard.conf
524 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-standard.monitrc
528 %defattr(644,root,root,755)
529 %attr(755,root,root) %{_sbindir}/%{name}-mail
530 %attr(770,root,%{name}) /var/cache/%{name}-mail
531 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-mail.conf
532 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-mail.monitrc
537 %defattr(644,root,root,755)
538 %attr(755,root,root) %{_sbindir}/%{name}-light
539 %attr(770,root,%{name}) /var/cache/%{name}-light
540 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-light.conf
541 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-light.monitrc
546 %defattr(644,root,root,755)
547 %attr(755,root,root) %{_sbindir}/%{name}-perl
548 attr(770,root,%{name}) /var/cache/%{name}-perl
549 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-perl.conf
550 %dir %{perl_vendorarch}/auto/%{name}
551 %attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so
552 %attr(700,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.bs
553 %attr(700,root,root) %{perl_vendorarch}/%{name}.pm
554 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-perl.monitrc