forked from jcu-eresearch/nginx-custom-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.spec2
510 lines (430 loc) · 15.2 KB
/
nginx.spec2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
#
%define nginx_home %{_localstatedir}/cache/nginx
%define nginx_user nginx
%define nginx_group nginx
%define nginx_loggroup adm
# distribution specific definitions
%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) || (0%{?suse_version} == 1315)
%if 0%{?rhel} == 5
Group: System Environment/Daemons
Requires(pre): shadow-utils
Requires: initscripts >= 8.36
Requires(post): chkconfig
Requires: openssl
BuildRequires: openssl-devel
%endif
%if 0%{?rhel} == 6
Group: System Environment/Daemons
Requires(pre): shadow-utils
Requires: initscripts >= 8.36
Requires(post): chkconfig
Requires: openssl >= 1.0.1
BuildRequires: openssl-devel >= 1.0.1
%define with_spdy 1
%endif
%if 0%{?rhel} == 7
Group: System Environment/Daemons
Requires(pre): shadow-utils
Requires: systemd
Requires: openssl >= 1.0.1
BuildRequires: systemd
BuildRequires: openssl-devel >= 1.0.1
Epoch: 1
%define with_spdy 1
%endif
%if 0%{?suse_version} == 1110
Group: Productivity/Networking/Web/Servers
BuildRequires: libopenssl-devel
Requires(pre): pwdutils
%define nginx_loggroup trusted
%endif
%if 0%{?suse_version} == 1315
Group: Productivity/Networking/Web/Servers
BuildRequires: libopenssl-devel
BuildRequires: systemd
Requires(pre): shadow
Requires: systemd
%define with_spdy 1
%define nginx_loggroup trusted
%endif
# end of distribution specific definitions
Summary: High performance web server
Name: nginx
Version: 1.6.3
Release: 1%{?dist}.ngx
Vendor: nginx inc.
URL: http://nginx.org/
Source0: http://nginx.org/download/%{name}-%{version}.tar.gz
Source1: logrotate
Source2: nginx.init
Source3: nginx.sysconf
Source4: nginx.conf
Source5: nginx.vh.default.conf
Source6: nginx.vh.example_ssl.conf
Source7: nginx.suse.init
Source8: nginx.service
Source9: nginx.upgrade.sh
Source10: nginx.suse.logrotate
#Source100: headers-more-nginx-module
Source101: ngx-fancyindex
Source102: nginx_ajp_module
#Source103: nginx-xslt-html-parser.patch
Source104: nginx-auth-ldap
#Source105: nginx-http-shibboleth
Source106: ngx_devel_kit
Source107: set-misc-nginx-module
License: 2-clause BSD-like license
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: zlib-devel
BuildRequires: pcre-devel
BuildRequires: openldap-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
Provides: webserver
%description
nginx [engine x] is an HTTP and reverse proxy server, as well as
a mail proxy server.
%package debug
Summary: debug version of nginx
Group: System Environment/Daemons
Requires: nginx
%description debug
Not stripped version of nginx built with the debugging log support.
%if 0%{?suse_version} == 1315
%debug_package
%endif
%prep
%setup -q
#cp -R -p %SOURCE100 .
cp -R -p %SOURCE101 .
cp -R -p %SOURCE102 .
#patch -p1 < %SOURCE103
cp -R -p %SOURCE104 .
#cp -R -p %SOURCE105 .
cp -R -p %SOURCE106 .
cp -R -p %SOURCE107 .
%build
./configure \
--prefix=%{_sysconfdir}/nginx \
--sbin-path=%{_sbindir}/nginx \
--conf-path=%{_sysconfdir}/nginx/nginx.conf \
--error-log-path=%{_localstatedir}/log/nginx/error.log \
--http-log-path=%{_localstatedir}/log/nginx/access.log \
--pid-path=%{_localstatedir}/run/nginx.pid \
--lock-path=%{_localstatedir}/run/nginx.lock \
--http-client-body-temp-path=%{_localstatedir}/cache/nginx/client_temp \
--http-proxy-temp-path=%{_localstatedir}/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=%{_localstatedir}/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=%{_localstatedir}/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=%{_localstatedir}/cache/nginx/scgi_temp \
--user=%{nginx_user} \
--group=%{nginx_group} \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-debug \
%{?with_spdy:--with-http_spdy_module} \
--with-http_spdy_module \
--with-http_xslt_module \
--with-cc-opt="%{optflags} $(pcre-config --cflags)" \
--add-module=%{_builddir}/%{name}-%{version}/ngx-fancyindex \
--add-module=%{_builddir}/%{name}-%{version}/nginx_ajp_module \
# --add-module=%{_builddir}/%{name}-%{version}/headers-more-nginx-module \
--add-module=%{_builddir}/%{name}-%{version}/nginx-auth-ldap \
# --add-module=%{_builddir}/%{name}-%{version}/nginx-http-shibboleth \
--add-module=%{_builddir}/%{name}-%{version}/ngx_devel_kit \
--add-module=%{_builddir}/%{name}-%{version}/set-misc-nginx-module \
$*
make %{?_smp_mflags}
%{__mv} %{_builddir}/%{name}-%{version}/objs/nginx \
%{_builddir}/%{name}-%{version}/objs/nginx.debug
./configure \
--prefix=%{_sysconfdir}/nginx \
--sbin-path=%{_sbindir}/nginx \
--conf-path=%{_sysconfdir}/nginx/nginx.conf \
--error-log-path=%{_localstatedir}/log/nginx/error.log \
--http-log-path=%{_localstatedir}/log/nginx/access.log \
--pid-path=%{_localstatedir}/run/nginx.pid \
--lock-path=%{_localstatedir}/run/nginx.lock \
--http-client-body-temp-path=%{_localstatedir}/cache/nginx/client_temp \
--http-proxy-temp-path=%{_localstatedir}/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=%{_localstatedir}/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=%{_localstatedir}/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=%{_localstatedir}/cache/nginx/scgi_temp \
--user=%{nginx_user} \
--group=%{nginx_group} \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
%{?with_spdy:--with-http_spdy_module} \
--with-cc-opt="%{optflags} $(pcre-config --cflags)" \
--with-http_spdy_module \
--with-http_xslt_module \
--add-module=%{_builddir}/%{name}-%{version}/ngx-fancyindex \
--add-module=%{_builddir}/%{name}-%{version}/nginx_ajp_module \
# --add-module=%{_builddir}/%{name}-%{version}/headers-more-nginx-module \
--add-module=%{_builddir}/%{name}-%{version}/nginx-auth-ldap \
# --add-module=%{_builddir}/%{name}-%{version}/nginx-http-shibboleth \
--add-module=%{_builddir}/%{name}-%{version}/ngx_devel_kit \
--add-module=%{_builddir}/%{name}-%{version}/set-misc-nginx-module \
$*
make %{?_smp_mflags}
%install
%{__rm} -rf $RPM_BUILD_ROOT
%{__make} DESTDIR=$RPM_BUILD_ROOT install
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/nginx
%{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/html $RPM_BUILD_ROOT%{_datadir}/nginx/
%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/nginx/*.default
%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/nginx/fastcgi.conf
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/log/nginx
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/run/nginx
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/cache/nginx
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d
%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/nginx.conf
%{__install} -m 644 -p %{SOURCE4} \
$RPM_BUILD_ROOT%{_sysconfdir}/nginx/nginx.conf
%{__install} -m 644 -p %{SOURCE5} \
$RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/default.conf
%{__install} -m 644 -p %{SOURCE6} \
$RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/example_ssl.conf
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
%{__install} -m 644 -p %{SOURCE3} \
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx
%if %{use_systemd}
# install systemd-specific files
%{__mkdir} -p $RPM_BUILD_ROOT%{_unitdir}
%{__install} -m644 %SOURCE8 \
$RPM_BUILD_ROOT%{_unitdir}/nginx.service
%{__mkdir} -p $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx
%{__install} -m755 %SOURCE9 \
$RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx/upgrade
%else
# install SYSV init stuff
%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir}
%if 0%{?suse_version} == 1110
%{__install} -m755 %{SOURCE7} \
$RPM_BUILD_ROOT%{_initrddir}/nginx
%else
%{__install} -m755 %{SOURCE2} \
$RPM_BUILD_ROOT%{_initrddir}/nginx
%endif
%endif
# install log rotation stuff
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
%if 0%{?suse_version}
%{__install} -m 644 -p %{SOURCE10} \
$RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/nginx
%else
%{__install} -m 644 -p %{SOURCE1} \
$RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/nginx
%endif
%{__install} -m644 %{_builddir}/%{name}-%{version}/objs/nginx.debug \
$RPM_BUILD_ROOT%{_sbindir}/nginx.debug
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_sbindir}/nginx
%dir %{_sysconfdir}/nginx
%dir %{_sysconfdir}/nginx/conf.d
%config(noreplace) %{_sysconfdir}/nginx/nginx.conf
%config(noreplace) %{_sysconfdir}/nginx/conf.d/default.conf
%config(noreplace) %{_sysconfdir}/nginx/conf.d/example_ssl.conf
%config(noreplace) %{_sysconfdir}/nginx/mime.types
%config(noreplace) %{_sysconfdir}/nginx/fastcgi_params
%config(noreplace) %{_sysconfdir}/nginx/scgi_params
%config(noreplace) %{_sysconfdir}/nginx/uwsgi_params
%config(noreplace) %{_sysconfdir}/nginx/koi-utf
%config(noreplace) %{_sysconfdir}/nginx/koi-win
%config(noreplace) %{_sysconfdir}/nginx/win-utf
%config(noreplace) %{_sysconfdir}/logrotate.d/nginx
%config(noreplace) %{_sysconfdir}/sysconfig/nginx
%if %{use_systemd}
%{_unitdir}/nginx.service
%dir %{_libexecdir}/initscripts/legacy-actions/nginx
%{_libexecdir}/initscripts/legacy-actions/nginx/*
%else
%{_initrddir}/nginx
%endif
%dir %{_datadir}/nginx
%dir %{_datadir}/nginx/html
%{_datadir}/nginx/html/*
%attr(0755,root,root) %dir %{_localstatedir}/cache/nginx
%attr(0755,root,root) %dir %{_localstatedir}/log/nginx
%files debug
%attr(0755,root,root) %{_sbindir}/nginx.debug
%pre
# Add the "nginx" user
getent group %{nginx_group} >/dev/null || groupadd -r %{nginx_group}
getent passwd %{nginx_user} >/dev/null || \
useradd -r -g %{nginx_group} -s /sbin/nologin \
-d %{nginx_home} -c "nginx user" %{nginx_user}
exit 0
%post
# Register the nginx service
if [ $1 -eq 1 ]; then
%if %{use_systemd}
/usr/bin/systemctl preset nginx.service >/dev/null 2>&1 ||:
%else
/sbin/chkconfig --add nginx
%endif
# print site info
cat <<BANNER
----------------------------------------------------------------------
Thanks for using nginx!
Please find the official documentation for nginx here:
* http://nginx.org/en/docs/
Commercial subscriptions for nginx are available on:
* http://nginx.com/products/
----------------------------------------------------------------------
BANNER
# Touch and set permisions on default log files on installation
if [ -d %{_localstatedir}/log/nginx ]; then
if [ ! -e %{_localstatedir}/log/nginx/access.log ]; then
touch %{_localstatedir}/log/nginx/access.log
%{__chmod} 640 %{_localstatedir}/log/nginx/access.log
%{__chown} nginx:%{nginx_loggroup} %{_localstatedir}/log/nginx/access.log
fi
if [ ! -e %{_localstatedir}/log/nginx/error.log ]; then
touch %{_localstatedir}/log/nginx/error.log
%{__chmod} 640 %{_localstatedir}/log/nginx/error.log
%{__chown} nginx:%{nginx_loggroup} %{_localstatedir}/log/nginx/error.log
fi
fi
fi
%preun
if [ $1 -eq 0 ]; then
%if %use_systemd
/usr/bin/systemctl --no-reload disable nginx.service >/dev/null 2>&1 ||:
/usr/bin/systemctl stop nginx.service >/dev/null 2>&1 ||:
%else
/sbin/service nginx stop > /dev/null 2>&1
/sbin/chkconfig --del nginx
%endif
fi
%postun
%if %use_systemd
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||:
%endif
if [ $1 -ge 1 ]; then
/sbin/service nginx status >/dev/null 2>&1 || exit 0
/sbin/service nginx upgrade >/dev/null 2>&1 || echo \
"Binary upgrade failed, please check nginx's error.log"
fi
%changelog
* Tue Apr 7 2015 Sergey Budnevitch <[email protected]>
- 1.6.3
* Tue Sep 16 2014 Sergey Budnevitch <[email protected]>
- epoch added to the EPEL7/CentOS7 spec to override EPEL one
- 1.6.2
* Thu Aug 5 2014 Sergey Budnevitch <[email protected]>
- 1.6.1
* Thu Jul 12 2014 Sergey Budnevitch <[email protected]>
- incorrect sysconfig filename finding in the initscript fixed
* Thu Apr 24 2014 Konstantin Pavlov <[email protected]>
- 1.6.0
- http-auth-request module added
* Tue Mar 18 2014 Sergey Budnevitch <[email protected]>
- 1.4.7
- spec cleanup
- openssl version dependence added
- upgrade() function in the init script improved
- warning added when binary upgrade returns non-zero exit code
* Tue Mar 4 2014 Sergey Budnevitch <[email protected]>
- 1.4.6
* Tue Feb 11 2014 Konstantin Pavlov <[email protected]>
- 1.4.5
* Tue Nov 19 2013 Sergey Budnevitch <[email protected]>
- 1.4.4
* Tue Oct 8 2013 Sergey Budnevitch <[email protected]>
- 1.4.3
* Tue Jul 17 2013 Sergey Budnevitch <[email protected]>
- 1.4.2
* Tue May 6 2013 Sergey Budnevitch <[email protected]>
- 1.4.1
* Wed Apr 24 2013 Sergey Budnevitch <[email protected]>
- gunzip module added
- 1.4.0
* Tue Apr 2 2013 Sergey Budnevitch <[email protected]>
- set permissions on default log files at installation
- 1.2.8
* Tue Feb 12 2013 Sergey Budnevitch <[email protected]>
- excess slash removed from --prefix
- 1.2.7
* Tue Dec 11 2012 Sergey Budnevitch <[email protected]>
- 1.2.6
* Tue Nov 13 2012 Sergey Budnevitch <[email protected]>
- 1.2.5
* Tue Sep 25 2012 Sergey Budnevitch <[email protected]>
- 1.2.4
* Tue Aug 7 2012 Sergey Budnevitch <[email protected]>
- 1.2.3
- nginx-debug package now actually contains non stripped binary
* Tue Jul 3 2012 Sergey Budnevitch <[email protected]>
- 1.2.2
* Tue Jun 5 2012 Sergey Budnevitch <[email protected]>
- 1.2.1
* Mon Apr 23 2012 Sergey Budnevitch <[email protected]>
- 1.2.0
* Thu Apr 12 2012 Sergey Budnevitch <[email protected]>
- 1.0.15
* Thu Mar 15 2012 Sergey Budnevitch <[email protected]>
- 1.0.14
- OpenSUSE init script and SuSE specific changes to spec file added
* Mon Mar 5 2012 Sergey Budnevitch <[email protected]>
- 1.0.13
* Mon Feb 6 2012 Sergey Budnevitch <[email protected]>
- 1.0.12
- banner added to install script
* Thu Dec 15 2011 Sergey Budnevitch <[email protected]>
- 1.0.11
- init script enhancements (thanks to Gena Makhomed)
- one second sleep during upgrade replaced with 0.1 sec usleep
* Tue Nov 15 2011 Sergey Budnevitch <[email protected]>
- 1.0.10
* Tue Nov 1 2011 Sergey Budnevitch <[email protected]>
- 1.0.9
- nginx-debug package added
* Tue Oct 11 2011 Sergey Budnevitch <[email protected]>
- spec file cleanup (thanks to Yury V. Zaytsev)
- log dir permitions fixed
- logrotate creates new logfiles with nginx owner
- "upgrade" argument to init-script added (based on fedora one)
* Sat Oct 1 2011 Sergey Budnevitch <[email protected]>
- 1.0.8
- built with mp4 module
* Fri Sep 30 2011 Sergey Budnevitch <[email protected]>
- 1.0.7
* Tue Aug 30 2011 Sergey Budnevitch <[email protected]>
- 1.0.6
- replace "conf.d/*" config include with "conf.d/*.conf" in default nginx.conf
* Tue Aug 10 2011 Sergey Budnevitch
- Initial release