3 # - /etc/sysconfig/nginx file
4 # - prepare style like nginx.conf
6 # Conditional build for nginx:
7 %bcond_without stub_status # stats module
11 %bcond_without ssl # ssl support
12 %bcond_without imap # imap proxy
13 %bcond_without addition
14 #%bcond_without perl # perl module
15 %bcond_with http_browser # header "User-agent" parser
17 Summary: High perfomance HTTP and reverse proxy server
18 Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
23 Group: Networking/Daemons
24 Source0: http://sysoev.ru/nginx/%{name}-%{version}.tar.gz
25 # Source0-md5: d84ef8e624b8953faf9cee2b5da535c1
27 Source2: %{name}-mime.types.sh
28 Source3: http://www.nginx.eu/favicon.ico
29 # Source3-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab
30 Source4: http://www.nginx.eu/download/proxy.conf
31 # Source4-md5: f5263ae01c2edb18f46d5d1df2d3a5cd
32 Source5: http://www.nginx.eu/download/%{name}.monitrc
33 # Source5-md5: 1d3f5eedfd34fe95213f9e0fc19daa88
34 Source6: http://www.nginx.eu/download/%{name}.conf
35 # Source6-md5: 1c112d6f03d0f365e4acc98c1d96261a
36 Source7: %{name}.logrotate
37 Patch0: %{name}-config.patch
38 URL: http://nginx.net/
39 BuildRequires: mailcap
40 BuildRequires: openssl-devel
41 BuildRequires: pcre-devel
42 BuildRequires: rpmbuild(macros) >= 1.268
43 BuildRequires: zlib-devel
44 Requires(post,preun): /sbin/chkconfig
45 Requires(postun): /usr/sbin/groupdel
46 Requires(postun): /usr/sbin/userdel
47 Requires(pre): /bin/id
48 Requires(pre): /usr/bin/getgid
49 Requires(pre): /usr/sbin/groupadd
50 Requires(pre): /usr/sbin/useradd
51 Requires: rc-scripts >= 0.2.0
53 Provides: group(nginx)
56 Conflicts: logrotate < 3.7-4
57 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
59 %define _sysconfdir /etc/%{name}
60 %define _nginxdir /home/services/%{name}
63 Nginx ("engine x") is a high-performance HTTP server and reverse
64 proxy, as well as an IMAP/POP3 proxy server. Nginx was written by Igor
65 Sysoev for Rambler.ru, Russia's second-most visited website, where it
66 has been running in production for over two and a half years. Igor has
67 released the source code under a BSD-like license. Although still in
68 beta, Nginx is known for its stability, rich feature set, simple
69 configuration, and low resource consumption.
71 %description -l pl.UTF-8
72 Serwer HTTP i odwrotne proxy o wysokiej wydajności.
75 %package -n monit-rc-nginx
76 Summary: Nginx support for monit
77 Summary(pl.UTF-8): Wsparcie nginx dla monit
78 Group: Applications/System
79 Requires: %{name} = %{version}-%{release}
82 %description -n monit-rc-nginx
83 monitrc file for monitoring nginx webserver server.
85 %description -n monit-rc-nginx -l pl.UTF-8
86 Plik monitrc do monitorowania serwera www nginx.
93 # build mime.types.conf
94 sh %{SOURCE2} /etc/mime.types
97 # NB: not autoconf generated configure
100 --sbin-path=%{_sbindir}/%{name} \
101 --conf-path=%{_sysconfdir}/%{name}.conf \
102 --error-log-path=%{_localstatedir}/log/%{name}/error.log \
103 --pid-path=%{_localstatedir}/run/%{name}.pid \
106 %{?with_stub_status:--with-http_stub_status_module} \
107 %{?with_rtsig:--with-rtsig_module} \
108 %{?with_select:--with-select_module} \
109 %{?with_poll:--with-poll_module} \
110 %{?with_ssl:--with-http_ssl_module} \
111 %{?with_addition:--with-http_addition_module} \
112 # %{?with_perl:--with-http_perl_module} \
113 %{?with_imap:--with-imap} \
114 %{!?with_http_browser:--without-http_browser_module} \
115 --http-log-path=%{_localstatedir}/log/%{name}/access.log \
116 --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
117 --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
118 --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
119 --with-cc="%{__cc}" \
120 --with-cc-opt="%{rpmcflags}" \
121 --with-ld-opt="%{rpmldflags}" \
122 %{?debug:--with-debug}
127 rm -rf $RPM_BUILD_ROOT
128 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
129 $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
130 $RPM_BUILD_ROOT{%{_localstatedir}/log/{%{name},archive/%{name}},%{_localstatedir}/cache/%{name}} \
131 $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}} \
132 $RPM_BUILD_ROOT/etc/{logrotate.d,monit}
134 install conf/* $RPM_BUILD_ROOT%{_sysconfdir}
135 install mime.types $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
136 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
137 install %{SOURCE3} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
138 install html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
139 install html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
140 install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
141 install %{SOURCE5} $RPM_BUILD_ROOT/etc/monit/%{name}.monitrc
142 install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/nginx.conf
143 install %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
145 install objs/%{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}
147 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.default
148 rm -rf $RPM_BUILD_ROOT%{_prefix}/html
151 rm -rf $RPM_BUILD_ROOT
154 %groupadd -r -g 213 %{name}
156 %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
157 %addusertogroup %{name} http
160 for a in access.log error.log; do
161 if [ ! -f /var/log/%{name}/$a ]; then
162 touch /var/log/%{name}/$a
163 chown nginx:nginx /var/log/%{name}/$a
164 chmod 644 /var/log/%{name}/$a
167 /sbin/chkconfig --add %{name}
168 %service %{name} restart
171 if [ "$1" = "0" ]; then
172 %service -q %{name} stop
173 /sbin/chkconfig --del %{name}
177 if [ "$1" = "0" ]; then
183 %defattr(644,root,root,755)
184 %doc CHANGES LICENSE README html/index.html conf/nginx.conf
185 %doc %lang(ru) CHANGES.ru
186 %attr(754,root,root) /etc/rc.d/init.d/%{name}
187 %dir %attr(754,root,root) %{_sysconfdir}
189 %dir %{_nginxdir}/cgi-bin
190 %dir %{_nginxdir}/html
191 %dir %{_nginxdir}/errors
192 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
193 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
194 %attr(640,root,root) %{_sysconfdir}/*[_-]*
195 %attr(640,root,root) %{_sysconfdir}/proxy.conf
196 %attr(640,root,root) %{_sysconfdir}/mime.types
197 %attr(755,root,root) %{_sbindir}/%{name}
198 %attr(770,root,%{name}) /var/cache/%{name}
199 %attr(750,root,root) %dir /var/log/archive/%{name}
200 %attr(750,%{name},logs) /var/log/%{name}
201 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
202 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
204 %files -n monit-rc-nginx
205 %defattr(644,root,root,755)
206 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc