]> git.pld-linux.org Git - packages/nginx.git/blame - nginx.spec
suggest vim-syntax-nginx
[packages/nginx.git] / nginx.spec
CommitLineData
f9e65082 1# TODO
ee4f2132 2# - /etc/sysconfig/nginx file
1c438d78 3# - missing perl build/install requires
ee4f2132 4#
362f5ab2 5# Conditional build for nginx:
056acc18 6%bcond_without 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
d0c0492d 9%bcond_without addition # adds module
10%bcond_without dav # WebDAV
11%bcond_without flv # FLV stream
3d4bad81 12%bcond_without ipv6 # build without ipv6 support
d6fc4b09 13%bcond_without sub # ngx_http_sub_module
d0c0492d 14%bcond_without poll # poll
15%bcond_without realip # real ip (behind proxy)
d0c0492d 16%bcond_without select # select
6f05a009 17%bcond_without http2 # HTTP/2 module
f2d29d05 18%bcond_without status # status module
d0c0492d 19%bcond_without ssl # ssl support
d54a9642 20%bcond_without threads # thread pool support
056acc18 21%bcond_with http_browser # header "User-agent" parser
3b14ae78 22%bcond_with rtmp # rtmp support
f2d29d05 23%bcond_with debug # enable debug logging: http://nginx.org/en/docs/debugging_log.html
e9a11359 24%bcond_without auth_request # auth_request module
ba5570e8 25%bcond_with modsecurity # modsecurity module
fb649fe5 26
8cf64677
WF
27%ifarch x32
28%undefine with_rtsig
29%endif
30
5d0d957d 31%define rtmp_version 1.1.7
ba5570e8 32%define modsecurity_version 2.9.0
8e1389c7 33Summary: High perfomance HTTP and reverse proxy server
185313bb 34Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
3dfa1ca2
AM
35# nginx lines:
36# - stable: production quality with stable API
37# - mainline: production quality but API can change
f9e65082 38Name: nginx
c8b57be2 39Version: 1.9.10
619c1aee 40Release: 2
51ef519b 41License: BSD-like
cbf76340 42Group: Networking/Daemons/HTTP
06e274b9 43Source0: http://nginx.org/download/%{name}-%{version}.tar.gz
c8b57be2 44# Source0-md5: 64cc970988356a5e0fc4fcd1ab84fe57
06e274b9 45Source1: http://nginx.net/favicon.ico
87404bf2 46# Source1-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab
06e274b9 47Source2: proxy.conf
226bcc40 48Source3: %{name}.logrotate
49Source4: %{name}.mime
226bcc40 50Source6: %{name}-light.monitrc
2cb3d9b2 51Source7: %{name}.init
0da077af 52Source8: %{name}-mail.conf
53Source9: %{name}-mail.monitrc
0da077af 54Source12: %{name}-perl.monitrc
5d9f0850 55Source14: %{name}.conf
0da077af 56Source15: %{name}-standard.monitrc
7d80c773 57Source17: %{name}-mime.types.sh
d323480a
JK
58Source18: %{name}-standard.service
59Source19: %{name}-light.service
60Source20: %{name}-perl.service
61Source21: %{name}-mail.service
ba5570e8
AO
62Source22: http://www.modsecurity.org/tarball/%{modsecurity_version}/modsecurity-%{modsecurity_version}.tar.gz
63# Source22-md5: ecf42d21f26338443d7111891851628c
5d0d957d
ER
64Source101: https://github.com/arut/nginx-rtmp-module/archive/v%{rtmp_version}/nginx-rtmp-module-%{rtmp_version}.tar.gz
65# Source101-md5: 8006de2560db3e55bb15d110220076ac
5ca9795d 66Patch0: %{name}-no-Werror.patch
7ce2935c 67Patch1: %{name}-modsecurity-xheaders.patch
51ef519b 68URL: http://nginx.net/
ba5570e8 69%{?with_modsecurity:BuildRequires: lua-devel}
dfef7372 70BuildRequires: mailcap
79797c48 71%{?with_ssl:BuildRequires: openssl-devel >= 1.0.2}
f1fc9780 72BuildRequires: pcre-devel
1c438d78 73%{?with_perl:BuildRequires: perl-CGI}
d0c0492d 74%{?with_perl:BuildRequires: perl-devel}
dd2388c2 75%{?with_perl:BuildRequires: python}
1c438d78 76%{?with_perl:BuildRequires: rpm-perlprov}
d323480a 77BuildRequires: rpmbuild(macros) >= 1.644
f9e65082
ER
78BuildRequires: zlib-devel
79BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
80
362f5ab2 81%define _sysconfdir /etc/%{name}
82%define _nginxdir /home/services/%{name}
f9e65082
ER
83
84%description
57f21172 85nginx ("engine x") is a high-performance HTTP server and reverse
86proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
894ff1f7
ER
87Sysoev for Rambler.ru, Russia's second-most visited website, where it
88has been running in production for over two and a half years. Igor has
89released the source code under a BSD-like license. Although still in
57f21172 90beta, nginx is known for its stability, rich feature set, simple
894ff1f7 91configuration, and low resource consumption.
8e1389c7 92
390f5b88 93%description -l pl.UTF-8
57f21172 94nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
5ca9795d
ER
95a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
96potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
056acc18 97odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
5ca9795d
ER
98opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
99fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
1dc54c84 100prostej konfiguracji oraz małej "zasobożerności".
2ee780b1 101
1a973791
JK
102%package common
103Summary: nginx - common files
104Summary(pl.UTF-8): nginx - pliki wspólne
105Group: Networking/Daemons/HTTP
106Requires(postun): /usr/sbin/groupdel
107Requires(postun): /usr/sbin/userdel
108Requires(pre): /bin/id
109Requires(pre): /usr/bin/getgid
110Requires(pre): /usr/sbin/groupadd
111Requires(pre): /usr/sbin/useradd
1a973791
JK
112Requires: rc-scripts >= 0.2.0
113Requires: systemd-units >= 38
1f74ff7c 114Suggests: vim-syntax-nginx
1a973791
JK
115Provides: group(http)
116Provides: group(nginx)
117Provides: user(nginx)
118Provides: webserver
5ca9795d 119Obsoletes: nginx < 1.4.1-4.1
1a973791 120Conflicts: logrotate < 3.8.0
1a973791
JK
121
122%description common
123Common files for the nginx daemon.
124
125%description common -l pl.UTF-8
57f21172 126Niezbędne pliki dla nginx.
85600569 127
2ee780b1 128%package light
129Summary: High perfomance HTTP and reverse proxy server
7ad53968 130Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
cbf76340 131Group: Networking/Daemons/HTTP
85600569 132Requires(post,preun): /sbin/chkconfig
1a973791
JK
133Requires(post,preun,postun): systemd-units >= 38
134Requires: %{name}-common = %{version}-%{release}
79797c48 135%{?with_ssl:Requires: openssl >= 1.0.2}
119e2f19 136Provides: nginx-daemon
2ee780b1 137Provides: webserver
138
139%description light
1a973791
JK
140nginx ("engine x") is a high-performance HTTP server and reverse
141proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
142Sysoev for Rambler.ru, Russia's second-most visited website, where it
143has been running in production for over two and a half years. Igor has
144released the source code under a BSD-like license. Although still in
145beta, nginx is known for its stability, rich feature set, simple
146configuration, and low resource consumption.
147
57f21172 148The smallest, but also the fastest nginx edition. No additional
7ad53968 149modules, no Perl, no DAV, no FLV, no IMAP, POP3, SMTP proxy.
2ee780b1 150
151%description light -l pl.UTF-8
1a973791 152nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
5ca9795d
ER
153a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
154potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
1a973791 155odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
5ca9795d
ER
156opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
157fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
1a973791
JK
158prostej konfiguracji oraz małej "zasobożerności".
159
57f21172 160Najmniejsza i najszybsza wersja nginx. Bez wsparcia dla Perla, DAV,
1cf92547 161FLV oraz IMAP, POP3, SMTP proxy.
2ee780b1 162
163%package perl
164Summary: High perfomance HTTP and reverse proxy server
7ad53968 165Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
cbf76340 166Group: Networking/Daemons/HTTP
85600569 167Requires(post,preun): /sbin/chkconfig
1a973791
JK
168Requires(post,preun,postun): systemd-units >= 38
169Requires: %{name}-common = %{version}-%{release}
79797c48 170%{?with_ssl:Requires: openssl >= 1.0.2}
1cf92547 171Provides: nginx-daemon
2ee780b1 172Provides: webserver
173
174%description perl
1a973791
JK
175nginx ("engine x") is a high-performance HTTP server and reverse
176proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
177Sysoev for Rambler.ru, Russia's second-most visited website, where it
178has been running in production for over two and a half years. Igor has
179released the source code under a BSD-like license. Although still in
180beta, nginx is known for its stability, rich feature set, simple
181configuration, and low resource consumption.
182
57f21172 183nginx with Perl support. Mail modules not included.
2ee780b1 184
185%description perl -l pl.UTF-8
1a973791 186nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
5ca9795d
ER
187a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
188potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
1a973791 189odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
5ca9795d
ER
190opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
191fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
1a973791
JK
192prostej konfiguracji oraz małej "zasobożerności".
193
57f21172 194nginx z obsługą Perla. Bez wsparcia dla modułów poczty.
2ee780b1 195
196%package mail
57f21172 197Summary: High perfomance IMAP, POP3, SMTP proxy server
198Summary(pl.UTF-8): IMAP, POP3, SMTP proxy o wysokiej wydajności
cbf76340 199Group: Networking/Daemons/HTTP
85600569 200Requires(post,preun): /sbin/chkconfig
1a973791
JK
201Requires(post,preun,postun): systemd-units >= 38
202Requires: %{name}-common = %{version}-%{release}
1cf92547 203Provides: nginx-daemon
2ee780b1 204
205%description mail
1a973791
JK
206nginx ("engine x") is a high-performance HTTP server and reverse
207proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
208Sysoev for Rambler.ru, Russia's second-most visited website, where it
209has been running in production for over two and a half years. Igor has
210released the source code under a BSD-like license. Although still in
211beta, nginx is known for its stability, rich feature set, simple
212configuration, and low resource consumption.
213
57f21172 214nginx with mail support. Only mail modules included.
2ee780b1 215
216%description mail -l pl.UTF-8
1a973791 217nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
5ca9795d
ER
218a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
219potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
1a973791 220odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
5ca9795d
ER
221opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
222fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
1a973791
JK
223prostej konfiguracji oraz małej "zasobożerności".
224
57f21172 225nginx ze wsparciem tylko dla modułów poczty.
2ee780b1 226
b0fa7cc6 227%package standard
57f21172 228Summary: High perfomance HTTP and reverse proxy server
4ca0234e 229Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
cbf76340 230Group: Networking/Daemons/HTTP
d6fc4b09 231Requires(post,preun): /sbin/chkconfig
1a973791
JK
232Requires(post,preun,postun): systemd-units >= 38
233Requires: %{name}-common = %{version}-%{release}
79797c48 234%{?with_ssl:Requires: openssl >= 1.0.2}
1a973791 235Provides: nginx
1cf92547 236Provides: nginx-daemon
d6fc4b09 237Conflicts: logrotate < 3.7-4
28a25161 238
b0fa7cc6 239%description standard
1a973791
JK
240nginx ("engine x") is a high-performance HTTP server and reverse
241proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
242Sysoev for Rambler.ru, Russia's second-most visited website, where it
243has been running in production for over two and a half years. Igor has
244released the source code under a BSD-like license. Although still in
245beta, nginx is known for its stability, rich feature set, simple
246configuration, and low resource consumption.
247
57f21172 248This is standard nginx version, without Perl support and IMAP, POP3,
5ca9795d 249SMTP proxy.
fccff804 250
b0fa7cc6 251%description standard -l pl.UTF-8
1a973791 252nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
5ca9795d
ER
253a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
254potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
1a973791 255odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
5ca9795d
ER
256opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
257fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
258prostej konfiguracji oraz małej "zasobożerności". ginx ("engine x")
259jest wysokowydajnym serwerem HTTP, odwrotnym proxy a także IMAP/POP3
260proxy. nginx został napisany przez Igora Sysoeva na potrzeby serwisu
261Rambler.ru. Jest to drugi pod względem ilości odwiedzin serwis w Rosji
262i działa od ponad dwóch i pół roku. Igor opublikował źródła na
263licencji BSD. Mimo, że projekt jest ciągle w fazie beta, już zasłynął
264dzięki stabilności, bogactwu dodatków, prostej konfiguracji oraz małej
265"zasobożerności".
1a973791 266
57f21172 267To jest standardowa wersja nginx, bez obsługi Perla oraz proxy dla
1dc54c84 268IMAP, POP3, SMTP.
85600569 269
dd7459ac 270%package -n monit-rc-nginx
57f21172 271Summary: nginx support for monit
272Summary(pl.UTF-8): Wsparcie nginx dla monit
60b8f836 273Group: Applications/System
274URL: http://nginx.eu/
1a973791 275Requires: %{name}-common = %{version}-%{release}
1cf92547 276Requires: monit
dd7459ac 277
278%description -n monit-rc-nginx
57f21172 279monitrc file for monitoring nginx webserver.
dd7459ac 280
281%description -n monit-rc-nginx -l pl.UTF-8
57f21172 282Plik monitrc do monitorowania serwera WWW nginx.
dd7459ac 283
f9e65082 284%prep
ba5570e8 285%setup -q %{?with_rtmp:-a101} %{?with_modsecurity:-a22}
717159c4 286%patch0 -p0
7ce2935c 287%{?with_modsecurity:%patch1 -p0}
f9e65082 288
fb649fe5
ER
289%if %{with rtmp}
290mv nginx-rtmp-module-%{rtmp_version} nginx-rtmp-module
291%endif
292
a8eaad11 293# build mime.types.conf
7d80c773 294#sh %{SOURCE17} /etc/mime.types
a8eaad11 295
f9e65082
ER
296%build
297# NB: not autoconf generated configure
056acc18 298cp -f configure auto/
5d0d957d 299
2fb62cf2
ER
300install -d bin
301
021e3ce8 302# build with default options
2fb62cf2 303build() {
78ac4e4e 304 local type=$1; shift
056acc18 305./configure \
306 --prefix=%{_prefix} \
78ac4e4e
ER
307 --sbin-path=%{_sbindir}/%{name}-$type \
308 --conf-path=%{_sysconfdir}/%{name}-$type.conf \
309 --error-log-path=%{_localstatedir}/log/%{name}/%{name}-${type}_error.log \
310 --http-log-path=%{_localstatedir}/log/%{name}/%{name}-${type}_access.log \
311 --pid-path=%{_localstatedir}/run/%{name}-$type.pid \
312 --lock-path=%{_localstatedir}/lock/subsys/%{name}-$type \
313 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-$type/client_body_temp \
314 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-$type/fastcgi_temp \
315 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-$type/proxy_temp \
2fb62cf2
ER
316 --user=nginx \
317 --group=nginx \
021e3ce8
ER
318 %{?with_ipv6:--with-ipv6} \
319 %{?with_select:--with-select_module} \
320 %{?with_poll:--with-poll_module} \
321 %{?with_rtsig:--with-rtsig_module} \
2fb62cf2
ER
322 --with-cc="%{__cc}" \
323 --with-cc-opt="%{rpmcflags}" \
324 --with-ld-opt="%{rpmldflags}" \
0aa7dc69 325 %{?with_debug:--with-debug} \
2fb62cf2
ER
326 "$@"
327%{__make}
328}
329
ba5570e8
AO
330%if %{with modsecurity}
331cd modsecurity-%{modsecurity_version}
332./autogen.sh
333%configure \
334 --enable-standalone-module \
335 --disable-mlogc \
336 --enable-alp2 \
337 --with-lua=/usr
338%{__make}
339cd ..
340%endif
341
2fb62cf2 342%if %{with perl}
78ac4e4e 343build perl \
056acc18 344 --with-http_perl_module \
345 %{?with_addition:--with-http_addition_module} \
346 %{?with_dav:--with-http_dav_module} \
347 %{?with_flv:--with-http_flv_module} \
d6fc4b09 348 %{?with_sub:--with-http_sub_module} \
056acc18 349 %{?with_realip:--with-http_realip_module} \
056acc18 350 %{?with_status:--with-http_stub_status_module} \
351 %{?with_ssl:--with-http_ssl_module} \
352 %{!?with_http_browser:--without-http_browser_module} \
fb649fe5 353 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
e9a11359 354 %{?with_auth_request:--with-http_auth_request_module} \
8cf64677 355 %{?with_threads:--with-threads} \
6f05a009 356 %{?with_http2:--with-http_v2_module} \
ca3f3f03 357 --with-http_secure_link_module \
2fb62cf2
ER
358 %{nil}
359
360mv -f objs/nginx bin/nginx-perl
361mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so bin/nginx.so
362mv -f objs/src/http/modules/perl/nginx.pm bin/nginx.pm
056acc18 363%endif
364
365%if %{with mail}
78ac4e4e 366build mail \
f2d29d05 367 --without-http \
056acc18 368 --with-imap \
369 --with-mail \
370 --with-mail_ssl_module \
2fb62cf2
ER
371 %{nil}
372
373mv -f objs/nginx bin/nginx-mail
056acc18 374%endif
375
376%if %{with light}
78ac4e4e 377build light \
056acc18 378 %{?with_realip:--with-http_realip_module} \
056acc18 379 %{?with_status:--with-http_stub_status_module} \
380 %{?with_ssl:--with-http_ssl_module} \
fb649fe5 381 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
e9a11359 382 %{?with_auth_request:--with-http_auth_request_module} \
8cf64677 383 %{?with_threads:--with-threads} \
6f05a009 384 %{?with_http2:--with-http_v2_module} \
ba5570e8 385 %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \
056acc18 386 --without-http_browser_module \
ca3f3f03 387 --with-http_secure_link_module \
2fb62cf2
ER
388 %{nil}
389
390mv -f objs/nginx bin/nginx-light
056acc18 391%endif
392
78ac4e4e 393build standard \
d0c0492d 394 %{?with_addition:--with-http_addition_module} \
395 %{?with_dav:--with-http_dav_module} \
396 %{?with_flv:--with-http_flv_module} \
d6fc4b09 397 %{?with_sub:--with-http_sub_module} \
d0c0492d 398 %{?with_realip:--with-http_realip_module} \
d0c0492d 399 %{?with_status:--with-http_stub_status_module} \
362f5ab2 400 %{?with_ssl:--with-http_ssl_module} \
ee4f2132 401 %{!?with_http_browser:--without-http_browser_module} \
fb649fe5 402 %{?with_rtmp:--add-module=./nginx-rtmp-module} \
e9a11359 403 %{?with_auth_request:--with-http_auth_request_module} \
8cf64677 404 %{?with_threads:--with-threads} \
619c1aee 405 %{?with_http2:--with-http_v2_module} \
ba5570e8 406 %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \
ca3f3f03 407 --with-http_secure_link_module \
2fb62cf2 408 %{nil}
f9e65082 409
98313a8a 410mv -f objs/nginx bin/nginx-standard
056acc18 411
f9e65082
ER
412%install
413rm -rf $RPM_BUILD_ROOT
362f5ab2 414install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
415 $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
4e61eac8 416 $RPM_BUILD_ROOT%{_localstatedir}/log/{%{name},archive/%{name}} \
226bcc40 417 $RPM_BUILD_ROOT%{_localstatedir}/cache/{%{name}-standard,%{name}-perl,%{name}-mail,%{name}-light} \
418 $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/{%{name}-standard,%{name}-perl,%{name}-mail,%{name}-light} \
36b3be34 419 $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/{vhosts,webapps}.d} \
d323480a 420 $RPM_BUILD_ROOT/etc/{logrotate.d,monit} \
599f35f0 421 $RPM_BUILD_ROOT{%{systemdunitdir},/etc/systemd/system}
f9e65082 422
32c47bd6 423cp -p conf/*_params $RPM_BUILD_ROOT%{_sysconfdir}
5ca9795d
ER
424cp -p conf/koi-utf $RPM_BUILD_ROOT%{_sysconfdir}/koi-utf
425cp -p conf/koi-win $RPM_BUILD_ROOT%{_sysconfdir}/koi-win
426cp -p conf/win-utf $RPM_BUILD_ROOT%{_sysconfdir}/win-utf
427cp -p html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
428cp -p html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
429cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
430cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
431cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
432cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
c9aa991c
ER
433
434install_build() {
435 local type=$1
f3753414 436 %{__sed} -e "s/@type@/${type}/g" %{_sourcedir}/%{name}.conf \
c9aa991c
ER
437 > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-$type.conf
438
439 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-$type
f3753414 440 %{__sed} -i -e "s/@type@/${type}/g" $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-$type
c9aa991c
ER
441
442 cp -p %{_sourcedir}/%{name}-$type.service $RPM_BUILD_ROOT%{systemdunitdir}
443 cp -p %{_sourcedir}/%{name}-$type.monitrc $RPM_BUILD_ROOT/etc/monit
444 install -p bin/%{name}-$type $RPM_BUILD_ROOT%{_sbindir}
445}
446
447install_build standard
599f35f0 448ln -sf %{systemdunitdir}/%{name}-standard.service $RPM_BUILD_ROOT/etc/systemd/system/nginx.service
85600569 449
450%if %{with light}
c9aa991c 451install_build light
85600569 452%endif
453
454%if %{with perl}
455install -d $RPM_BUILD_ROOT{%{perl_vendorarch},%{perl_vendorarch}/auto/%{name}}
c9aa991c 456install_build perl
2fb62cf2
ER
457cp -p bin/nginx.pm $RPM_BUILD_ROOT%{perl_vendorarch}/%{name}.pm
458install -p bin/nginx.so $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.so
459install -p bin/nginx-perl $RPM_BUILD_ROOT%{_sbindir}
85600569 460%endif
f9e65082 461
c9aa991c
ER
462%if %{with mail}
463install_build mail
464%endif
465
32c47bd6
ER
466# only touch these for ghost packaging
467touch $RPM_BUILD_ROOT%{_sysconfdir}/{fastcgi,scgi,uwsgi}.params
468
f9e65082
ER
469%clean
470rm -rf $RPM_BUILD_ROOT
471
1a973791 472%pre common
a37373c3 473%groupadd -r -g 213 %{name}
362f5ab2 474%groupadd -g 51 http
a37373c3 475%useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
362f5ab2 476%addusertogroup %{name} http
f1fc9780 477
738166d2 478%post standard
479for a in access.log error.log; do
480 if [ ! -f /var/log/%{name}/nginx-standard_$a ]; then
98376457 481 umask 022
738166d2 482 touch /var/log/%{name}/nginx-standard_$a
1cf92547 483 chown nginx:nginx /var/log/%{name}/nginx-standard_$a
738166d2 484 chmod 644 /var/log/%{name}/nginx-standard_$a
485 fi
486done
3d760264 487/sbin/chkconfig --add %{name}-standard
d323480a 488%systemd_post %{name}-standard.service
27d3b195 489%service %{name}-standard force-reload
a20d2702 490echo 'NOTE: this nginx daemon is using "/etc/nginx/nginx-standard.conf" as config.'
599f35f0
JK
491if ! [ -L /etc/systemd/system/nginx.service ] ; then
492 ln -s %{systemdunitdir}/%{name}-standard.service /etc/systemd/system/nginx.service || :
493fi
738166d2 494
495%post light
496for a in access.log error.log; do
497 if [ ! -f /var/log/%{name}/nginx-light_$a ]; then
98376457 498 umask 022
738166d2 499 touch /var/log/%{name}/nginx-light_$a
500 chown nginx:nginx /var/log/%{name}/nginx-light_$a
501 chmod 644 /var/log/%{name}/nginx-light_$a
502 fi
503done
3d760264 504/sbin/chkconfig --add %{name}-light
d323480a 505%systemd_post %{name}-light.service
27d3b195 506%service %{name}-light force-reload
a20d2702 507echo 'NOTE: this nginx daemon is using "/etc/nginx/nginx-light.conf" as config'
738166d2 508
509%post perl
510for a in access.log error.log; do
511 if [ ! -f /var/log/%{name}/nginx-perl_$a ]; then
98376457 512 umask 022
738166d2 513 touch /var/log/%{name}/nginx-perl_$a
514 chown nginx:nginx /var/log/%{name}/nginx-perl_$a
515 chmod 644 /var/log/%{name}/nginx-perl_$a
516 fi
517done
3d760264 518/sbin/chkconfig --add %{name}-perl
d323480a 519%systemd_post %{name}-perl.service
27d3b195 520%service %{name}-perl force-reload
a20d2702 521echo 'NOTE: this nginx daemon is using "/etc/nginx/nginx-perl.conf" as config'
738166d2 522
523%post mail
362f5ab2 524for a in access.log error.log; do
738166d2 525 if [ ! -f /var/log/%{name}/nginx-mail_$a ]; then
98376457 526 umask 022
738166d2 527 touch /var/log/%{name}/nginx-mail_$a
528 chown nginx:nginx /var/log/%{name}/nginx-mail_$a
529 chmod 644 /var/log/%{name}/nginx-mail_$a
362f5ab2 530 fi
531done
3d760264 532/sbin/chkconfig --add %{name}-mail
d323480a 533%systemd_post %{name}-mail.service
27d3b195 534%service %{name}-mail force-reload
a20d2702 535echo 'NOTE: this nginx daemon is using "/etc/nginx/nginx-mail.conf" as config'
f9e65082 536
b0fa7cc6 537%preun standard
7d80c773 538if [ "$1" = "0" ];then
6eef4074 539 %service %{name}-standard stop
226bcc40 540 /sbin/chkconfig --del %{name}-standard
f9e65082 541fi
d323480a 542%systemd_preun %{name}-standard.service
f9e65082 543
0663f9da 544%preun light
545if [ "$1" = "0" ]; then
6eef4074 546 %service %{name}-light stop
226bcc40 547 /sbin/chkconfig --del %{name}-light
0663f9da 548fi
d323480a 549%systemd_preun %{name}-light.service
0663f9da 550
551%preun perl
552if [ "$1" = "0" ]; then
6eef4074 553 %service %{name}-perl stop
226bcc40 554 /sbin/chkconfig --del %{name}-perl
0663f9da 555fi
d323480a 556%systemd_preun %{name}-perl.service
0663f9da 557
558%preun mail
559if [ "$1" = "0" ]; then
6eef4074 560 %service %{name}-mail stop
226bcc40 561 /sbin/chkconfig --del %{name}-mail
0663f9da 562fi
d323480a 563%systemd_preun %{name}-mail.service
0663f9da 564
1a973791 565%postun common
f1fc9780 566if [ "$1" = "0" ]; then
7d9b86c7
ER
567 %userremove %{name}
568 %groupremove %{name}
f1fc9780 569fi
570
d323480a
JK
571%postun standard
572%systemd_reload
573
574%postun light
575%systemd_reload
576
577%postun perl
578%systemd_reload
579
580%postun mail
581%systemd_reload
582
583%triggerpostun -- %{name}-standard < 1.4.1-4
584%systemd_trigger %{name}-standard.service
585
586%triggerpostun -- %{name}-light < 1.4.1-4
587%systemd_trigger %{name}-light.service
588
589%triggerpostun -- %{name}-perl < 1.4.1-4
590%systemd_trigger %{name}-perl.service
591
592%triggerpostun -- %{name}-mail < 1.4.1-4
593%systemd_trigger %{name}-mail.service
594
32c47bd6
ER
595%triggerpostun common -- %{name}-common < 1.8.0-2
596# skip *this* trigger on downgrade
597[ $1 -le 1 ] && exit 0
598ln -sf fastcgi_params %{_sysconfdir}/fastcgi.params
599ln -sf scgi_params %{_sysconfdir}/scgi.params
600ln -sf uwsgi_params %{_sysconfdir}/uwsgi.params
601exit 0
602
1a973791 603%files common
f9e65082 604%defattr(644,root,root,755)
6f8318ed 605%doc CHANGES LICENSE README html/index.html conf/nginx.conf
f9e65082 606%doc %lang(ru) CHANGES.ru
37ddc577 607%dir %attr(750,root,nginx) %{_sysconfdir}
164ab75d 608%dir %{_nginxdir}
609%dir %{_nginxdir}/cgi-bin
610%dir %{_nginxdir}/html
611%dir %{_nginxdir}/errors
28a25161 612%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
98376457 613# XXX: duplicates, don't use such glob here
57f21172 614#%attr(640,root,root) %{_sysconfdir}/*[_-]*
98376457 615%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/proxy.conf
32c47bd6
ER
616%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fastcgi_params
617%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/scgi_params
618%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/uwsgi_params
619%ghost %{_sysconfdir}/fastcgi.params
620%ghost %{_sysconfdir}/scgi.params
621%ghost %{_sysconfdir}/uwsgi.params
f1fc9780 622%attr(640,root,root) %{_sysconfdir}/mime.types
57f21172 623%attr(640,root,root) %{_sysconfdir}/koi-utf
624%attr(640,root,root) %{_sysconfdir}/koi-win
625%attr(640,root,root) %{_sysconfdir}/win-utf
36b3be34
JK
626%dir %{_sysconfdir}/webapps.d
627%dir %{_sysconfdir}/vhosts.d
debe6eba
JR
628%attr(750,nginx,logs) %dir /var/log/archive/%{name}
629%attr(750,nginx,logs) /var/log/%{name}
475fecd1 630%config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
cd728db7 631%config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
599f35f0 632%ghost /etc/systemd/system/nginx.service
28a25161 633
b0fa7cc6 634%files standard
635%defattr(644,root,root,755)
de0bfb9b 636%attr(755,root,root) %{_sbindir}/%{name}-standard
1846cd14 637%attr(770,root,%{name}) /var/cache/%{name}-standard
0da077af 638%attr(754,root,root) /etc/rc.d/init.d/%{name}-standard
4ddbebd7 639%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-standard.conf
d323480a 640%{systemdunitdir}/%{name}-standard.service
b0fa7cc6 641
85600569 642%if %{with mail}
643%files mail
644%defattr(644,root,root,755)
4e61eac8 645%attr(755,root,root) %{_sbindir}/%{name}-mail
1846cd14 646%attr(770,root,%{name}) /var/cache/%{name}-mail
0da077af 647%attr(754,root,root) /etc/rc.d/init.d/%{name}-mail
4ddbebd7 648%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-mail.conf
d323480a 649%{systemdunitdir}/%{name}-mail.service
85600569 650%endif
651
652%if %{with light}
653%files light
654%defattr(644,root,root,755)
4e61eac8 655%attr(755,root,root) %{_sbindir}/%{name}-light
1846cd14 656%attr(770,root,%{name}) /var/cache/%{name}-light
0da077af 657%attr(754,root,root) /etc/rc.d/init.d/%{name}-light
4ddbebd7 658%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-light.conf
d323480a 659%{systemdunitdir}/%{name}-light.service
85600569 660%endif
661
662%if %{with perl}
663%files perl
664%defattr(644,root,root,755)
4e61eac8 665%attr(755,root,root) %{_sbindir}/%{name}-perl
0da077af 666%attr(754,root,root) /etc/rc.d/init.d/%{name}-perl
f7b57295 667%attr(770,root,%{name}) /var/cache/%{name}-perl
1846cd14 668%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-perl.conf
85600569 669%dir %{perl_vendorarch}/auto/%{name}
670%attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so
98376457 671%{perl_vendorarch}/%{name}.pm
d323480a 672%{systemdunitdir}/%{name}-perl.service
dd7459ac 673%endif
674
675%files -n monit-rc-nginx
676%defattr(644,root,root,755)
677%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-standard.monitrc
678%if %{with perl}
1846cd14 679%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-perl.monitrc
85600569 680%endif
dd7459ac 681%if %{with light}
682%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-light.monitrc
683%endif
684%if %{with mail}
685%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-mail.monitrc
686%endif
This page took 0.144284 seconds and 4 git commands to generate.