]>
Commit | Line | Data |
---|---|---|
f9e65082 | 1 | # TODO |
ee4f2132 | 2 | # - /etc/sysconfig/nginx file |
1c438d78 | 3 | # - missing perl build/install requires |
ee4f2132 | 4 | # |
362f5ab2 | 5 | # Conditional build for nginx: |
d2732616 ER |
6 | # Features |
7 | %bcond_with debug # enable debug logging: http://nginx.org/en/docs/debugging_log.html | |
d54a9642 | 8 | %bcond_without threads # thread pool support |
d2732616 ER |
9 | # Modules |
10 | %bcond_without addition # http addition module | |
11 | %bcond_without auth_request # auth_request module | |
12 | %bcond_without dav # WebDAV | |
13 | %bcond_without flv # http FLV module | |
278483d6 | 14 | %bcond_without gd # without http image filter module |
82f38dc6 | 15 | %bcond_without geoip # without http geoip module and stream geoip module |
d2732616 | 16 | %bcond_without http2 # HTTP/2 module |
056acc18 | 17 | %bcond_without mail # don't build imap/mail proxy |
18 | %bcond_without perl # don't build with perl module | |
d2732616 | 19 | %bcond_without poll # poll module |
d0c0492d | 20 | %bcond_without realip # real ip (behind proxy) |
d2732616 ER |
21 | %bcond_without select # select module |
22 | %bcond_without ssl # ssl support and http ssl module | |
23 | %bcond_without stream # TCP/UDP proxy module | |
24 | %bcond_without stub_status # http stub status module | |
25 | %bcond_without sub # ngx_http_sub_module | |
278483d6 | 26 | %bcond_without xslt # without http xslt module |
d2732616 | 27 | %bcond_with http_browser # http browser module (header "User-agent" parser) |
ba5570e8 | 28 | %bcond_with modsecurity # modsecurity module |
d2732616 | 29 | %bcond_with rtmp # rtmp support |
a7bd1a0f | 30 | %bcond_without vts # virtual host traffic status module |
fb649fe5 | 31 | |
8cf64677 WF |
32 | %ifarch x32 |
33 | %undefine with_rtsig | |
34 | %endif | |
35 | ||
27ce902f | 36 | %define ssl_version 1.0.2 |
a71fb2d9 | 37 | %define rtmp_version 1.2.1 |
a7bd1a0f | 38 | %define vts_version 0.1.18 |
ba5edeb7 | 39 | %define modsecurity_version 2.9.3 |
8e1389c7 | 40 | Summary: High perfomance HTTP and reverse proxy server |
185313bb | 41 | Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności |
3dfa1ca2 AM |
42 | # nginx lines: |
43 | # - stable: production quality with stable API | |
44 | # - mainline: production quality but API can change | |
f9e65082 | 45 | Name: nginx |
e344670b | 46 | Version: 1.16.1 |
06baebc4 | 47 | Release: 1 |
51ef519b | 48 | License: BSD-like |
cbf76340 | 49 | Group: Networking/Daemons/HTTP |
06e274b9 | 50 | Source0: http://nginx.org/download/%{name}-%{version}.tar.gz |
e344670b | 51 | # Source0-md5: 45a80f75336c980d240987badc3dcf60 |
06e274b9 | 52 | Source1: http://nginx.net/favicon.ico |
87404bf2 | 53 | # Source1-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab |
06e274b9 | 54 | Source2: proxy.conf |
226bcc40 | 55 | Source3: %{name}.logrotate |
56 | Source4: %{name}.mime | |
7f97359c | 57 | Source6: %{name}.monitrc |
2cb3d9b2 | 58 | Source7: %{name}.init |
5d9f0850 | 59 | Source14: %{name}.conf |
7d80c773 | 60 | Source17: %{name}-mime.types.sh |
8d0ed4b0 | 61 | Source18: %{name}.service |
ba5570e8 | 62 | Source22: http://www.modsecurity.org/tarball/%{modsecurity_version}/modsecurity-%{modsecurity_version}.tar.gz |
ba5edeb7 | 63 | # Source22-md5: 215a96d679a5b0fadcf13b5d09b35422 |
278483d6 | 64 | Source101: https://github.com/arut/nginx-rtmp-module/archive/v%{rtmp_version}/%{name}-rtmp-module-%{rtmp_version}.tar.gz |
a71fb2d9 | 65 | # Source101-md5: 639ac2b78103adaccbcfe484a92acf44 |
a7bd1a0f AM |
66 | Source102: https://github.com/vozlt/nginx-module-vts/archive/v%{vts_version}.tar.gz |
67 | # Source102-md5: 409a10dbd85e0b807cc77eecec29a3b5 | |
5ca9795d | 68 | Patch0: %{name}-no-Werror.patch |
7ce2935c | 69 | Patch1: %{name}-modsecurity-xheaders.patch |
b7a97f81 | 70 | URL: http://nginx.org/ |
dfef7372 | 71 | BuildRequires: mailcap |
f1fc9780 | 72 | BuildRequires: pcre-devel |
d323480a | 73 | BuildRequires: rpmbuild(macros) >= 1.644 |
f9e65082 | 74 | BuildRequires: zlib-devel |
278483d6 ER |
75 | %if %{with geoip} |
76 | BuildRequires: GeoIP-devel | |
77 | %endif | |
78 | %if %{with gd} | |
79 | BuildRequires: gd-devel | |
80 | %endif | |
81 | %if %{with modsecurity} | |
82 | BuildRequires: lua-devel | |
83 | %endif | |
84 | %if %{with perl} | |
85 | BuildRequires: perl-CGI | |
86 | BuildRequires: perl-devel | |
87 | BuildRequires: python | |
88 | BuildRequires: rpm-perlprov | |
89 | %endif | |
90 | %if %{with ssl} | |
91 | BuildRequires: openssl-devel >= %{ssl_version} | |
92 | Requires: openssl >= %{ssl_version} | |
93 | %endif | |
94 | %if %{with xslt} | |
95 | BuildRequires: libxslt-devel | |
96 | %endif | |
1a973791 JK |
97 | Provides: group(http) |
98 | Provides: group(nginx) | |
99 | Provides: user(nginx) | |
4ac1d45f | 100 | Provides: webserver |
9b47506f AM |
101 | Provides: webserver(access) |
102 | Provides: webserver(alias) | |
81d5057a JK |
103 | Provides: webserver(auth) |
104 | Provides: webserver(expires) | |
105 | Provides: webserver(headers) | |
1e42c256 | 106 | Provides: webserver(indexfile) |
81d5057a JK |
107 | Provides: webserver(log) |
108 | Provides: webserver(mime) | |
109 | Provides: webserver(reqtimeout) | |
110 | Provides: webserver(rewrite) | |
111 | Provides: webserver(setenv) | |
1a973791 | 112 | Conflicts: logrotate < 3.8.0 |
85600569 | 113 | Requires(post,preun): /sbin/chkconfig |
1a973791 | 114 | Requires(post,preun,postun): systemd-units >= 38 |
4ac1d45f ER |
115 | Requires(postun): /usr/sbin/groupdel |
116 | Requires(postun): /usr/sbin/userdel | |
117 | Requires(pre): /bin/id | |
118 | Requires(pre): /usr/bin/getgid | |
119 | Requires(pre): /usr/sbin/groupadd | |
120 | Requires(pre): /usr/sbin/useradd | |
121 | Requires: rc-scripts >= 0.2.0 | |
122 | Requires: systemd-units >= 38 | |
123 | Suggests: vim-syntax-nginx | |
7cd50bff AM |
124 | Obsoletes: nginx-common < 1.13.3 |
125 | Obsoletes: nginx-light < 1.13.3 | |
126 | Obsoletes: nginx-standard < 1.13.3 | |
6d00ffc3 | 127 | Conflicts: rpm < 4.4.2-0.2 |
4ac1d45f | 128 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
1a973791 | 129 | |
4ac1d45f ER |
130 | %define _sysconfdir /etc/%{name} |
131 | %define _nginxdir /home/services/%{name} | |
1a973791 | 132 | |
6d00ffc3 ER |
133 | # minimizing restarts logics. we restart webserver: |
134 | # | |
135 | # 1. at the end of transaction. (posttrans, feature from rpm 4.4.2) | |
136 | # 2. first install of module (post: $1 = 1) | |
137 | # 2. uninstall of module (postun: $1 == 0) | |
138 | # | |
139 | # the strict internal deps between modules and | |
140 | # main package are very important for all this to work. | |
85600569 | 141 | |
6d00ffc3 ER |
142 | # restart webserver at the end of transaction |
143 | ||
144 | %define restart_webserver \ | |
145 | %systemd_post %{name}.service \ | |
146 | %service %{name} force-reload \ | |
147 | %{nil} | |
148 | ||
149 | # macro called at module post scriptlet | |
150 | %define module_post \ | |
151 | if [ "$1" = "1" ]; then \ | |
152 | %restart_webserver \ | |
153 | fi | |
154 | ||
155 | # macro called at module postun scriptlet | |
156 | %define module_postun \ | |
157 | if [ "$1" = "0" ]; then \ | |
158 | %restart_webserver \ | |
159 | fi | |
160 | ||
161 | # it's sooo annoying to write them | |
162 | %define module_scripts() \ | |
163 | %post %1 \ | |
164 | %module_post \ | |
165 | \ | |
166 | %postun %1 \ | |
167 | %module_postun | |
2ee780b1 | 168 | |
4ac1d45f | 169 | %description |
1a973791 JK |
170 | nginx ("engine x") is a high-performance HTTP server and reverse |
171 | proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor | |
172 | Sysoev for Rambler.ru, Russia's second-most visited website, where it | |
173 | has been running in production for over two and a half years. Igor has | |
174 | released the source code under a BSD-like license. Although still in | |
175 | beta, nginx is known for its stability, rich feature set, simple | |
176 | configuration, and low resource consumption. | |
177 | ||
4ac1d45f | 178 | %description -l pl.UTF-8 |
1a973791 | 179 | nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy |
5ca9795d ER |
180 | a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na |
181 | potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości | |
1a973791 | 182 | odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor |
5ca9795d ER |
183 | opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w |
184 | fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków, | |
1a973791 JK |
185 | prostej konfiguracji oraz małej "zasobożerności". |
186 | ||
278483d6 ER |
187 | %package mod_http_geoip |
188 | Summary: Nginx HTTP geoip module | |
189 | Group: Daemons | |
190 | Requires: %{name} = %{version}-%{release} | |
191 | Requires: GeoIP | |
2ee780b1 | 192 | |
278483d6 ER |
193 | %description mod_http_geoip |
194 | Nginx HTTP geoip module. | |
2ee780b1 | 195 | |
82f38dc6 ER |
196 | %package mod_stream_geoip |
197 | Summary: Nginx stream geoip module | |
198 | Group: Daemons | |
199 | Requires: %{name} = %{version}-%{release} | |
57aa9c0a | 200 | Requires: %{name}-mod_stream = %{version}-%{release} |
82f38dc6 | 201 | Requires: GeoIP |
1a973791 | 202 | |
82f38dc6 ER |
203 | %description mod_stream_geoip |
204 | Nginx stream geoip module. | |
2ee780b1 | 205 | |
278483d6 ER |
206 | %package mod_http_image_filter |
207 | Summary: Nginx HTTP image filter module | |
208 | Group: Daemons | |
209 | Requires: %{name} = %{version}-%{release} | |
1a973791 | 210 | |
278483d6 ER |
211 | %description mod_http_image_filter |
212 | Nginx HTTP image filter module. | |
2ee780b1 | 213 | |
f5d76ba0 ER |
214 | %package mod_http_perl |
215 | Summary: Nginx HTTP Perl module | |
cbf76340 | 216 | Group: Networking/Daemons/HTTP |
4ac1d45f | 217 | Requires: %{name} = %{version}-%{release} |
2ee780b1 | 218 | |
f5d76ba0 ER |
219 | %description mod_http_perl |
220 | Nginx HTTP Perl module. | |
1a973791 | 221 | |
278483d6 ER |
222 | %package mod_http_xslt_filter |
223 | Summary: Nginx XSLT module | |
224 | Group: Daemons | |
225 | Requires: %{name} = %{version}-%{release} | |
2ee780b1 | 226 | |
278483d6 ER |
227 | %description mod_http_xslt_filter |
228 | Nginx XSLT module. | |
2ee780b1 | 229 | |
f5d76ba0 ER |
230 | %package mod_mail |
231 | Summary: Nginx mail module | |
cbf76340 | 232 | Group: Networking/Daemons/HTTP |
4ac1d45f | 233 | Requires: %{name} = %{version}-%{release} |
28a25161 | 234 | |
f5d76ba0 ER |
235 | %description mod_mail |
236 | Nginx mail module. | |
1a973791 | 237 | |
9b4add35 AM |
238 | %package mod_vts |
239 | Summary: Nginx virtual host traffic status module | |
240 | Group: Networking/Daemons/HTTP | |
241 | Requires: %{name} = %{version}-%{release} | |
242 | ||
243 | %description mod_vts | |
244 | Nginx virtual host traffic status module. | |
245 | ||
278483d6 ER |
246 | %package mod_stream |
247 | Summary: Nginx stream modules | |
248 | Group: Daemons | |
249 | Requires: %{name} = %{version}-%{release} | |
fccff804 | 250 | |
278483d6 ER |
251 | %description mod_stream |
252 | Nginx stream modules. | |
85600569 | 253 | |
dd7459ac | 254 | %package -n monit-rc-nginx |
57f21172 | 255 | Summary: nginx support for monit |
256 | Summary(pl.UTF-8): Wsparcie nginx dla monit | |
60b8f836 | 257 | Group: Applications/System |
4ac1d45f | 258 | Requires: %{name} = %{version}-%{release} |
1cf92547 | 259 | Requires: monit |
dd7459ac | 260 | |
261 | %description -n monit-rc-nginx | |
57f21172 | 262 | monitrc file for monitoring nginx webserver. |
dd7459ac | 263 | |
264 | %description -n monit-rc-nginx -l pl.UTF-8 | |
57f21172 | 265 | Plik monitrc do monitorowania serwera WWW nginx. |
dd7459ac | 266 | |
f9e65082 | 267 | %prep |
a7bd1a0f | 268 | %setup -q %{?with_rtmp:-a101} %{?with_modsecurity:-a22} %{?with_vts:-a102} |
717159c4 | 269 | %patch0 -p0 |
7ce2935c | 270 | %{?with_modsecurity:%patch1 -p0} |
f9e65082 | 271 | |
fb649fe5 ER |
272 | %if %{with rtmp} |
273 | mv nginx-rtmp-module-%{rtmp_version} nginx-rtmp-module | |
274 | %endif | |
275 | ||
a7bd1a0f AM |
276 | %if %{with vts} |
277 | mv nginx-module-vts-%{vts_version} nginx-vts-module | |
278 | %endif | |
279 | ||
a8eaad11 | 280 | # build mime.types.conf |
7d80c773 | 281 | #sh %{SOURCE17} /etc/mime.types |
a8eaad11 | 282 | |
f9e65082 ER |
283 | %build |
284 | # NB: not autoconf generated configure | |
056acc18 | 285 | cp -f configure auto/ |
5d0d957d | 286 | |
056acc18 | 287 | ./configure \ |
288 | --prefix=%{_prefix} \ | |
483adace | 289 | --modules-path=%{_libdir}/%{name}/modules \ |
efc6207e ER |
290 | --sbin-path=%{_sbindir}/%{name} \ |
291 | --conf-path=%{_sysconfdir}/%{name}.conf \ | |
292 | --error-log-path=%{_localstatedir}/log/%{name}/error.log \ | |
293 | --http-log-path=%{_localstatedir}/log/%{name}/access.log \ | |
294 | --pid-path=%{_localstatedir}/run/%{name}.pid \ | |
295 | --lock-path=%{_localstatedir}/lock/subsys/%{name} \ | |
296 | --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \ | |
297 | --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \ | |
298 | --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \ | |
0bd5043b | 299 | --http-uwsgi-temp-path=%{_localstatedir}/cache/%{name}/uwsgi_temp \ |
bfad744d | 300 | --http-scgi-temp-path=%{_localstatedir}/cache/%{name}/scgi_temp \ |
2fb62cf2 ER |
301 | --user=nginx \ |
302 | --group=nginx \ | |
021e3ce8 ER |
303 | %{?with_select:--with-select_module} \ |
304 | %{?with_poll:--with-poll_module} \ | |
305 | %{?with_rtsig:--with-rtsig_module} \ | |
278483d6 | 306 | %{?with_perl:--with-http_perl_module=dynamic} \ |
278483d6 ER |
307 | %{?with_gd:--with-http_image_filter_module=dynamic} \ |
308 | %{?with_xslt:--with-http_xslt_module=dynamic} \ | |
82f38dc6 ER |
309 | %{?with_geoip:--with-http_geoip_module=dynamic} \ |
310 | %{?with_geoip:--with-stream_geoip_module=dynamic} \ | |
008e09c3 ER |
311 | %if %{with mail} |
312 | --with-mail=dynamic \ | |
313 | --with-mail_ssl_module \ | |
278483d6 ER |
314 | %endif |
315 | %if %{with stream} | |
316 | --with-stream=dynamic \ | |
317 | --with-stream_ssl_module \ | |
008e09c3 | 318 | %endif |
2fb62cf2 ER |
319 | --with-cc="%{__cc}" \ |
320 | --with-cc-opt="%{rpmcflags}" \ | |
321 | --with-ld-opt="%{rpmldflags}" \ | |
0aa7dc69 | 322 | %{?with_debug:--with-debug} \ |
056acc18 | 323 | %{?with_addition:--with-http_addition_module} \ |
324 | %{?with_dav:--with-http_dav_module} \ | |
325 | %{?with_flv:--with-http_flv_module} \ | |
d6fc4b09 | 326 | %{?with_sub:--with-http_sub_module} \ |
056acc18 | 327 | %{?with_realip:--with-http_realip_module} \ |
d2732616 | 328 | %{?with_stub_status:--with-http_stub_status_module} \ |
056acc18 | 329 | %{?with_ssl:--with-http_ssl_module} \ |
330 | %{!?with_http_browser:--without-http_browser_module} \ | |
fb649fe5 | 331 | %{?with_rtmp:--add-module=./nginx-rtmp-module} \ |
9b4add35 | 332 | %{?with_vts:--add-dynamic-module=./nginx-vts-module} \ |
e9a11359 | 333 | %{?with_auth_request:--with-http_auth_request_module} \ |
8cf64677 | 334 | %{?with_threads:--with-threads} \ |
6f05a009 | 335 | %{?with_http2:--with-http_v2_module} \ |
ba5570e8 | 336 | %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \ |
ca3f3f03 | 337 | --with-http_secure_link_module \ |
2fb62cf2 ER |
338 | %{nil} |
339 | ||
53215d5e | 340 | %{__make} |
f9e65082 | 341 | |
53215d5e ER |
342 | %if %{with modsecurity} |
343 | cd modsecurity-%{modsecurity_version} | |
344 | ./autogen.sh | |
345 | %configure \ | |
346 | --enable-standalone-module \ | |
347 | --disable-mlogc \ | |
348 | --enable-alp2 \ | |
349 | --with-lua=/usr | |
350 | %{__make} | |
351 | cd .. | |
352 | %endif | |
056acc18 | 353 | |
f9e65082 ER |
354 | %install |
355 | rm -rf $RPM_BUILD_ROOT | |
362f5ab2 | 356 | install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \ |
357 | $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \ | |
4e61eac8 | 358 | $RPM_BUILD_ROOT%{_localstatedir}/log/{%{name},archive/%{name}} \ |
c63e9e18 ER |
359 | $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name} \ |
360 | $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/%{name} \ | |
97ac281a | 361 | $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/{conf,modules,vhosts,webapps}.d} \ |
924400ca | 362 | $RPM_BUILD_ROOT%{_sysconfdir}/snippets \ |
d323480a | 363 | $RPM_BUILD_ROOT/etc/{logrotate.d,monit} \ |
599f35f0 | 364 | $RPM_BUILD_ROOT{%{systemdunitdir},/etc/systemd/system} |
f9e65082 | 365 | |
483adace ER |
366 | %{__make} install \ |
367 | INSTALLDIRS=vendor \ | |
368 | DESTDIR=$RPM_BUILD_ROOT | |
369 | ||
370 | %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/*.default | |
371 | ||
7f97359c ER |
372 | cp -p %{_sourcedir}/%{name}.conf $RPM_BUILD_ROOT%{_sysconfdir} |
373 | cp -p %{_sourcedir}/%{name}.service $RPM_BUILD_ROOT%{systemdunitdir} | |
374 | cp -p %{_sourcedir}/%{name}.monitrc $RPM_BUILD_ROOT/etc/monit | |
c63e9e18 ER |
375 | install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} |
376 | ||
483adace ER |
377 | cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name} |
378 | cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf | |
3c75ce8a | 379 | cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/mime.types |
483adace | 380 | rm -r $RPM_BUILD_ROOT%{_prefix}/html |
5ca9795d ER |
381 | cp -p html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html |
382 | cp -p html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors | |
383 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico | |
c9aa991c | 384 | |
a88a446d ER |
385 | load_module() { |
386 | local module=ngx_${1}_module.so conffile=mod_$1.conf | |
9453c586 | 387 | printf 'load_module "%{_libdir}/%{name}/modules/%s";' "$module" \ |
97ac281a | 388 | > $RPM_BUILD_ROOT%{_sysconfdir}/modules.d/$conffile |
c9aa991c ER |
389 | } |
390 | ||
85600569 | 391 | %if %{with perl} |
483adace ER |
392 | %{__rm} $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod |
393 | %{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/auto/nginx/.packlist | |
a88a446d | 394 | load_module http_perl |
85600569 | 395 | %endif |
f9e65082 | 396 | |
a88a446d ER |
397 | %if %{with geoip} |
398 | load_module http_geoip | |
763de572 | 399 | load_module stream_geoip |
a88a446d ER |
400 | %endif |
401 | %if %{with gd} | |
402 | load_module http_image_filter | |
403 | %endif | |
404 | %if %{with xslt} | |
405 | load_module http_xslt_filter | |
406 | %endif | |
c9aa991c | 407 | %if %{with mail} |
a88a446d ER |
408 | load_module mail |
409 | %endif | |
d925a29b | 410 | %{?with_vts:load_module http_vhost_traffic_status} |
a88a446d ER |
411 | %if %{with stream} |
412 | load_module stream | |
c9aa991c | 413 | %endif |
32c47bd6 | 414 | |
f9e65082 ER |
415 | %clean |
416 | rm -rf $RPM_BUILD_ROOT | |
417 | ||
c63e9e18 | 418 | %pre |
a37373c3 | 419 | %groupadd -r -g 213 %{name} |
362f5ab2 | 420 | %groupadd -g 51 http |
a37373c3 | 421 | %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name} |
362f5ab2 | 422 | %addusertogroup %{name} http |
f1fc9780 | 423 | |
c63e9e18 | 424 | %post |
738166d2 | 425 | for a in access.log error.log; do |
c63e9e18 | 426 | if [ ! -f /var/log/%{name}/$a ]; then |
98376457 | 427 | umask 022 |
c63e9e18 ER |
428 | touch /var/log/%{name}/$a |
429 | chown nginx:nginx /var/log/%{name}/$a | |
430 | chmod 644 /var/log/%{name}/$a | |
738166d2 | 431 | fi |
432 | done | |
c63e9e18 | 433 | /sbin/chkconfig --add %{name} |
738166d2 | 434 | |
6d00ffc3 ER |
435 | %posttrans |
436 | %restart_webserver | |
738166d2 | 437 | |
c63e9e18 | 438 | %preun |
7d80c773 | 439 | if [ "$1" = "0" ];then |
c63e9e18 ER |
440 | %service %{name} stop |
441 | /sbin/chkconfig --del %{name} | |
f9e65082 | 442 | fi |
c63e9e18 | 443 | %systemd_preun %{name}.service |
f9e65082 | 444 | |
c63e9e18 | 445 | %postun |
f1fc9780 | 446 | if [ "$1" = "0" ]; then |
7d9b86c7 ER |
447 | %userremove %{name} |
448 | %groupremove %{name} | |
f1fc9780 | 449 | fi |
d323480a JK |
450 | %systemd_reload |
451 | ||
6d00ffc3 ER |
452 | %module_scripts mod_http_geoip |
453 | %module_scripts mod_http_image_filter | |
454 | %module_scripts mod_http_perl | |
455 | %module_scripts mod_http_xslt_filter | |
456 | %module_scripts mod_mail | |
9b4add35 | 457 | %module_scripts mod_vts |
6d00ffc3 ER |
458 | %module_scripts mod_stream |
459 | %module_scripts mod_stream_geoip | |
d323480a | 460 | |
c63e9e18 | 461 | %files |
f9e65082 | 462 | %defattr(644,root,root,755) |
6f8318ed | 463 | %doc CHANGES LICENSE README html/index.html conf/nginx.conf |
f9e65082 | 464 | %doc %lang(ru) CHANGES.ru |
28a25161 | 465 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name} |
7f6266e4 ER |
466 | %attr(754,root,root) /etc/rc.d/init.d/%{name} |
467 | %dir %attr(750,root,nginx) %{_sysconfdir} | |
943e8c63 | 468 | %dir %{_sysconfdir}/conf.d |
97ac281a | 469 | %dir %{_sysconfdir}/modules.d |
924400ca | 470 | %dir %{_sysconfdir}/snippets |
7f6266e4 ER |
471 | %dir %{_sysconfdir}/vhosts.d |
472 | %dir %{_sysconfdir}/webapps.d | |
f1fc9780 | 473 | %attr(640,root,root) %{_sysconfdir}/mime.types |
57f21172 | 474 | %attr(640,root,root) %{_sysconfdir}/koi-utf |
475 | %attr(640,root,root) %{_sysconfdir}/koi-win | |
476 | %attr(640,root,root) %{_sysconfdir}/win-utf | |
ba3249a3 | 477 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fastcgi.conf |
7f6266e4 ER |
478 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nginx.conf |
479 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/proxy.conf | |
480 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fastcgi_params | |
481 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/scgi_params | |
482 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/uwsgi_params | |
483adace | 483 | %attr(755,root,root) %{_sbindir}/%{name} |
278483d6 ER |
484 | %dir %{_libdir}/%{name} |
485 | %dir %{_libdir}/%{name}/modules | |
c63e9e18 | 486 | %{systemdunitdir}/%{name}.service |
b0fa7cc6 | 487 | |
debe6eba JR |
488 | %attr(750,nginx,logs) %dir /var/log/archive/%{name} |
489 | %attr(750,nginx,logs) /var/log/%{name} | |
7f6266e4 ER |
490 | %attr(770,root,nginx) /var/cache/%{name} |
491 | ||
492 | %dir %{_nginxdir} | |
493 | %dir %{_nginxdir}/cgi-bin | |
494 | %dir %{_nginxdir}/html | |
495 | %dir %{_nginxdir}/errors | |
475fecd1 | 496 | %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/* |
cd728db7 | 497 | %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/* |
28a25161 | 498 | |
278483d6 ER |
499 | %if %{with geoip} |
500 | %files mod_http_geoip | |
b0fa7cc6 | 501 | %defattr(644,root,root,755) |
97ac281a | 502 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_geoip.conf |
278483d6 | 503 | %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_geoip_module.so |
b0fa7cc6 | 504 | |
82f38dc6 | 505 | %files mod_stream_geoip |
85600569 | 506 | %defattr(644,root,root,755) |
97ac281a | 507 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_stream_geoip.conf |
82f38dc6 | 508 | %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_stream_geoip_module.so |
85600569 | 509 | %endif |
510 | ||
278483d6 ER |
511 | %if %{with gd} |
512 | %files mod_http_image_filter | |
85600569 | 513 | %defattr(644,root,root,755) |
97ac281a | 514 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_image_filter.conf |
278483d6 | 515 | %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_image_filter_module.so |
85600569 | 516 | %endif |
517 | ||
518 | %if %{with perl} | |
f5d76ba0 | 519 | %files mod_http_perl |
85600569 | 520 | %defattr(644,root,root,755) |
97ac281a | 521 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_perl.conf |
008e09c3 | 522 | %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_perl_module.so |
85600569 | 523 | %dir %{perl_vendorarch}/auto/%{name} |
524 | %attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so | |
98376457 | 525 | %{perl_vendorarch}/%{name}.pm |
483adace | 526 | %{_mandir}/man3/nginx.3pm* |
dd7459ac | 527 | %endif |
528 | ||
278483d6 ER |
529 | %if %{with xslt} |
530 | %files mod_http_xslt_filter | |
dd7459ac | 531 | %defattr(644,root,root,755) |
97ac281a | 532 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_xslt_filter.conf |
278483d6 | 533 | %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_xslt_filter_module.so |
dd7459ac | 534 | %endif |
278483d6 | 535 | |
dd7459ac | 536 | %if %{with mail} |
278483d6 ER |
537 | %files mod_mail |
538 | %defattr(644,root,root,755) | |
97ac281a | 539 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_mail.conf |
278483d6 | 540 | %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_mail_module.so |
dd7459ac | 541 | %endif |
278483d6 | 542 | |
9b4add35 AM |
543 | %if %{with vts} |
544 | %files mod_vts | |
545 | %defattr(644,root,root,755) | |
d925a29b | 546 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_http_vhost_traffic_status.conf |
9b4add35 AM |
547 | %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_vhost_traffic_status_module.so |
548 | %endif | |
549 | ||
278483d6 ER |
550 | %if %{with stream} |
551 | %files mod_stream | |
552 | %defattr(644,root,root,755) | |
97ac281a | 553 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/modules.d/mod_stream.conf |
278483d6 ER |
554 | %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_stream_module.so |
555 | %endif | |
556 | ||
dd7459ac | 557 | %files -n monit-rc-nginx |
558 | %defattr(644,root,root,755) | |
c63e9e18 | 559 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc |