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