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