2 # - /etc/sysconfig/nginx file
3 # - missing perl build/install requires
5 # Conditional build for nginx:
6 %bcond_with light # don't build light version
7 %bcond_without mail # don't build imap/mail proxy
8 %bcond_without perl # don't build with perl module
9 %bcond_without addition # adds module
10 %bcond_without dav # WebDAV
11 %bcond_without flv # FLV stream
12 %bcond_without ipv6 # build without ipv6 support
13 %bcond_without sub # ngx_http_sub_module
14 %bcond_without poll # poll
15 %bcond_without realip # real ip (behind proxy)
16 %bcond_without select # select
17 %bcond_without http2 # HTTP/2 module
18 %bcond_without status # status module
19 %bcond_without ssl # ssl support
20 %bcond_without threads # thread pool support
21 %bcond_with http_browser # header "User-agent" parser
22 %bcond_with rtmp # rtmp support
23 %bcond_with debug # enable debug logging: http://nginx.org/en/docs/debugging_log.html
24 %bcond_without auth_request # auth_request module
25 %bcond_with modsecurity # modsecurity module
31 %define ssl_version 1.0.2
32 %define rtmp_version 1.1.7
33 %define modsecurity_version 2.9.1
34 Summary: High perfomance HTTP and reverse proxy server
35 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
37 # - stable: production quality with stable API
38 # - mainline: production quality but API can change
43 Group: Networking/Daemons/HTTP
44 Source0: http://nginx.org/download/%{name}-%{version}.tar.gz
45 # Source0-md5: db43f2b19746f6f47401c3afc3924dc6
46 Source1: http://nginx.net/favicon.ico
47 # Source1-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab
49 Source3: %{name}.logrotate
51 Source6: %{name}.monitrc
53 Source14: %{name}.conf
54 Source17: %{name}-mime.types.sh
55 Source18: %{name}.service
56 Source22: http://www.modsecurity.org/tarball/%{modsecurity_version}/modsecurity-%{modsecurity_version}.tar.gz
57 # Source22-md5: 0fa92b852abc857a20b9e24f83f814cf
58 Source101: https://github.com/arut/nginx-rtmp-module/archive/v%{rtmp_version}/nginx-rtmp-module-%{rtmp_version}.tar.gz
59 # Source101-md5: 8006de2560db3e55bb15d110220076ac
60 Patch0: %{name}-no-Werror.patch
61 Patch1: %{name}-modsecurity-xheaders.patch
62 URL: http://nginx.net/
63 %{?with_modsecurity:BuildRequires: lua-devel}
64 BuildRequires: mailcap
65 %{?with_ssl:BuildRequires: openssl-devel >= %{ssl_version}}
66 BuildRequires: pcre-devel
67 %{?with_perl:BuildRequires: perl-CGI}
68 %{?with_perl:BuildRequires: perl-devel}
69 %{?with_perl:BuildRequires: python}
70 %{?with_perl:BuildRequires: rpm-perlprov}
71 BuildRequires: rpmbuild(macros) >= 1.644
72 BuildRequires: zlib-devel
73 %{?with_ssl:Requires: openssl >= %{ssl_version}}
75 Provides: group(nginx)
78 Provides: webserver(access)
79 Provides: webserver(alias)
80 Provides: webserver(auth)
81 Provides: webserver(expires)
82 Provides: webserver(headers)
83 Provides: webserver(indexfile)
84 Provides: webserver(log)
85 Provides: webserver(mime)
86 Provides: webserver(reqtimeout)
87 Provides: webserver(rewrite)
88 Provides: webserver(setenv)
89 Conflicts: logrotate < 3.8.0
90 Requires(post,preun): /sbin/chkconfig
91 Requires(post,preun,postun): systemd-units >= 38
92 Requires(postun): /usr/sbin/groupdel
93 Requires(postun): /usr/sbin/userdel
94 Requires(pre): /bin/id
95 Requires(pre): /usr/bin/getgid
96 Requires(pre): /usr/sbin/groupadd
97 Requires(pre): /usr/sbin/useradd
98 Requires: rc-scripts >= 0.2.0
99 Requires: systemd-units >= 38
100 Suggests: vim-syntax-nginx
101 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
103 %define _sysconfdir /etc/%{name}
104 %define _nginxdir /home/services/%{name}
107 nginx ("engine x") is a high-performance HTTP server and reverse
108 proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
109 Sysoev for Rambler.ru, Russia's second-most visited website, where it
110 has been running in production for over two and a half years. Igor has
111 released the source code under a BSD-like license. Although still in
112 beta, nginx is known for its stability, rich feature set, simple
113 configuration, and low resource consumption.
115 %description -l pl.UTF-8
116 nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
117 a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
118 potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
119 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
120 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
121 fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
122 prostej konfiguracji oraz małej "zasobożerności".
125 Summary: High perfomance HTTP and reverse proxy server
126 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
127 Group: Networking/Daemons/HTTP
128 Requires: %{name} = %{version}-%{release}
131 nginx ("engine x") is a high-performance HTTP server and reverse
132 proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
133 Sysoev for Rambler.ru, Russia's second-most visited website, where it
134 has been running in production for over two and a half years. Igor has
135 released the source code under a BSD-like license. Although still in
136 beta, nginx is known for its stability, rich feature set, simple
137 configuration, and low resource consumption.
139 nginx with Perl support. Mail modules not included.
141 %description perl -l pl.UTF-8
142 nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
143 a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
144 potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
145 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
146 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
147 fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
148 prostej konfiguracji oraz małej "zasobożerności".
150 nginx z obsługą Perla. Bez wsparcia dla modułów poczty.
153 Summary: High perfomance IMAP, POP3, SMTP proxy server
154 Summary(pl.UTF-8): IMAP, POP3, SMTP proxy o wysokiej wydajności
155 Group: Networking/Daemons/HTTP
156 Requires: %{name} = %{version}-%{release}
159 nginx ("engine x") is a high-performance HTTP server and reverse
160 proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
161 Sysoev for Rambler.ru, Russia's second-most visited website, where it
162 has been running in production for over two and a half years. Igor has
163 released the source code under a BSD-like license. Although still in
164 beta, nginx is known for its stability, rich feature set, simple
165 configuration, and low resource consumption.
167 nginx with mail support. Only mail modules included.
169 %description mail -l pl.UTF-8
170 nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
171 a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
172 potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
173 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
174 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
175 fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
176 prostej konfiguracji oraz małej "zasobożerności".
178 nginx ze wsparciem tylko dla modułów poczty.
180 %package -n monit-rc-nginx
181 Summary: nginx support for monit
182 Summary(pl.UTF-8): Wsparcie nginx dla monit
183 Group: Applications/System
184 Requires: %{name} = %{version}-%{release}
187 %description -n monit-rc-nginx
188 monitrc file for monitoring nginx webserver.
190 %description -n monit-rc-nginx -l pl.UTF-8
191 Plik monitrc do monitorowania serwera WWW nginx.
194 %setup -q %{?with_rtmp:-a101} %{?with_modsecurity:-a22}
196 %{?with_modsecurity:%patch1 -p0}
199 mv nginx-rtmp-module-%{rtmp_version} nginx-rtmp-module
202 # build mime.types.conf
203 #sh %{SOURCE17} /etc/mime.types
206 # NB: not autoconf generated configure
207 cp -f configure auto/
211 # build with default options
215 --prefix=%{_prefix} \
216 --modules-path=%{_libdir}/%{name}/modules \
217 --sbin-path=%{_sbindir}/%{name} \
218 --conf-path=%{_sysconfdir}/%{name}.conf \
219 --error-log-path=%{_localstatedir}/log/%{name}/error.log \
220 --http-log-path=%{_localstatedir}/log/%{name}/access.log \
221 --pid-path=%{_localstatedir}/run/%{name}.pid \
222 --lock-path=%{_localstatedir}/lock/subsys/%{name} \
223 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
224 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
225 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
228 %{?with_ipv6:--with-ipv6} \
229 %{?with_select:--with-select_module} \
230 %{?with_poll:--with-poll_module} \
231 %{?with_rtsig:--with-rtsig_module} \
233 --with-http_perl_module=dynamic \
236 --with-mail=dynamic \
237 --with-mail_ssl_module \
239 --with-cc="%{__cc}" \
240 --with-cc-opt="%{rpmcflags}" \
241 --with-ld-opt="%{rpmldflags}" \
242 %{?with_debug:--with-debug} \
247 %if %{with modsecurity}
248 cd modsecurity-%{modsecurity_version}
251 --enable-standalone-module \
259 %if %{with perl} && 0
261 --with-http_perl_module \
262 %{?with_addition:--with-http_addition_module} \
263 %{?with_dav:--with-http_dav_module} \
264 %{?with_flv:--with-http_flv_module} \
265 %{?with_sub:--with-http_sub_module} \
266 %{?with_realip:--with-http_realip_module} \
267 %{?with_status:--with-http_stub_status_module} \
268 %{?with_ssl:--with-http_ssl_module} \
269 %{!?with_http_browser:--without-http_browser_module} \
270 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
271 %{?with_auth_request:--with-http_auth_request_module} \
272 %{?with_threads:--with-threads} \
273 %{?with_http2:--with-http_v2_module} \
274 --with-http_secure_link_module \
277 mv -f objs/nginx bin/nginx-perl
278 mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so bin/nginx.so
279 mv -f objs/src/http/modules/perl/nginx.pm bin/nginx.pm
282 %if %{with mail} && 0
287 --with-mail_ssl_module \
290 mv -f objs/nginx bin/nginx-mail
295 %{?with_realip:--with-http_realip_module} \
296 %{?with_status:--with-http_stub_status_module} \
297 %{?with_ssl:--with-http_ssl_module} \
298 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
299 %{?with_auth_request:--with-http_auth_request_module} \
300 %{?with_threads:--with-threads} \
301 %{?with_http2:--with-http_v2_module} \
302 %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \
303 --without-http_browser_module \
304 --with-http_secure_link_module \
307 mv -f objs/nginx bin/nginx-light
311 %{?with_addition:--with-http_addition_module} \
312 %{?with_dav:--with-http_dav_module} \
313 %{?with_flv:--with-http_flv_module} \
314 %{?with_sub:--with-http_sub_module} \
315 %{?with_realip:--with-http_realip_module} \
316 %{?with_status:--with-http_stub_status_module} \
317 %{?with_ssl:--with-http_ssl_module} \
318 %{!?with_http_browser:--without-http_browser_module} \
319 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
320 %{?with_auth_request:--with-http_auth_request_module} \
321 %{?with_threads:--with-threads} \
322 %{?with_http2:--with-http_v2_module} \
323 %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \
324 --with-http_secure_link_module \
328 rm -rf $RPM_BUILD_ROOT
329 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
330 $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
331 $RPM_BUILD_ROOT%{_localstatedir}/log/{%{name},archive/%{name}} \
332 $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name} \
333 $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/%{name} \
334 $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/{vhosts,webapps}.d} \
335 $RPM_BUILD_ROOT/etc/{logrotate.d,monit} \
336 $RPM_BUILD_ROOT{%{systemdunitdir},/etc/systemd/system}
340 DESTDIR=$RPM_BUILD_ROOT
342 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/*.default
344 cp -p %{_sourcedir}/%{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}
345 cp -p %{_sourcedir}/%{name}.service $RPM_BUILD_ROOT%{systemdunitdir}
346 cp -p %{_sourcedir}/%{name}.monitrc $RPM_BUILD_ROOT/etc/monit
347 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
349 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
350 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
351 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
352 rm -r $RPM_BUILD_ROOT%{_prefix}/html
353 cp -p html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
354 cp -p html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
355 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
358 %{__rm} $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod
359 %{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/auto/nginx/.packlist
362 # only touch these for ghost packaging
363 touch $RPM_BUILD_ROOT%{_sysconfdir}/{fastcgi,scgi,uwsgi}.params
366 rm -rf $RPM_BUILD_ROOT
369 %groupadd -r -g 213 %{name}
371 %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
372 %addusertogroup %{name} http
375 for a in access.log error.log; do
376 if [ ! -f /var/log/%{name}/$a ]; then
378 touch /var/log/%{name}/$a
379 chown nginx:nginx /var/log/%{name}/$a
380 chmod 644 /var/log/%{name}/$a
383 /sbin/chkconfig --add %{name}
384 %systemd_post %{name}.service
385 %service %{name} force-reload
388 if [ "$1" = "0" ];then
389 %service %{name} stop
390 /sbin/chkconfig --del %{name}
392 %systemd_preun %{name}.service
395 if [ "$1" = "0" ]; then
401 %triggerpostun -- %{name} < 1.8.0-2
402 # skip *this* trigger on downgrade
403 [ $1 -le 1 ] && exit 0
404 ln -sf fastcgi_params %{_sysconfdir}/fastcgi.params
405 ln -sf scgi_params %{_sysconfdir}/scgi.params
406 ln -sf uwsgi_params %{_sysconfdir}/uwsgi.params
410 %defattr(644,root,root,755)
411 %doc CHANGES LICENSE README html/index.html conf/nginx.conf
412 %doc %lang(ru) CHANGES.ru
413 %dir %attr(750,root,nginx) %{_sysconfdir}
415 %dir %{_nginxdir}/cgi-bin
416 %dir %{_nginxdir}/html
417 %dir %{_nginxdir}/errors
418 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
419 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/proxy.conf
420 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fastcgi_params
421 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/scgi_params
422 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/uwsgi_params
423 %ghost %{_sysconfdir}/fastcgi.params
424 %ghost %{_sysconfdir}/scgi.params
425 %ghost %{_sysconfdir}/uwsgi.params
426 %attr(640,root,root) %{_sysconfdir}/mime.types
427 %attr(640,root,root) %{_sysconfdir}/koi-utf
428 %attr(640,root,root) %{_sysconfdir}/koi-win
429 %attr(640,root,root) %{_sysconfdir}/win-utf
430 %dir %{_sysconfdir}/webapps.d
431 %dir %{_sysconfdir}/vhosts.d
432 %attr(750,nginx,logs) %dir /var/log/archive/%{name}
433 %attr(750,nginx,logs) /var/log/%{name}
434 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
435 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
437 %defattr(644,root,root,755)
438 %attr(755,root,root) %{_sbindir}/%{name}
439 %attr(770,root,%{name}) /var/cache/%{name}
440 %attr(754,root,root) /etc/rc.d/init.d/%{name}
441 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
442 %{systemdunitdir}/%{name}.service
446 %defattr(644,root,root,755)
447 %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_mail_module.so
452 %defattr(644,root,root,755)
453 %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_perl_module.so
454 %dir %{perl_vendorarch}/auto/%{name}
455 %attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so
456 %{perl_vendorarch}/%{name}.pm
457 %{_mandir}/man3/nginx.3pm*
460 %files -n monit-rc-nginx
461 %defattr(644,root,root,755)
462 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc