]>
Commit | Line | Data |
---|---|---|
f9e65082 | 1 | # TODO |
362f5ab2 | 2 | # - more bconds (??) |
ee4f2132 | 3 | # - /etc/sysconfig/nginx file |
4 | # - prepare style like nginx.conf | |
5 | # | |
362f5ab2 | 6 | # Conditional build for nginx: |
ee4f2132 | 7 | %bcond_without stub_status # stats module |
8 | %bcond_without rtsig | |
9 | %bcond_without select | |
10 | %bcond_without poll | |
11 | %bcond_without ssl # ssl support | |
12 | %bcond_without imap # imap proxy | |
13 | %bcond_with http_browser # header "User-agent" parser | |
362f5ab2 | 14 | # |
8e1389c7 | 15 | Summary: High perfomance HTTP and reverse proxy server |
185313bb | 16 | Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności |
f9e65082 | 17 | Name: nginx |
22019997 | 18 | Version: 0.5.31 |
fb1687bb | 19 | Release: 3.1 |
51ef519b | 20 | License: BSD-like |
7d9b86c7 | 21 | Group: Networking/Daemons |
f1fc9780 | 22 | Source0: http://sysoev.ru/nginx/%{name}-%{version}.tar.gz |
22019997 | 23 | # Source0-md5: d84ef8e624b8953faf9cee2b5da535c1 |
f1fc9780 | 24 | Source1: %{name}.init |
dfef7372 | 25 | Source2: %{name}-mime.types.sh |
362f5ab2 | 26 | Source3: http://www.nginx.eu/favicon.ico |
27 | # Source3-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab | |
28 | Source4: http://www.nginx.eu/download/proxy.conf | |
29 | # Source4-md5: f5263ae01c2edb18f46d5d1df2d3a5cd | |
894ff1f7 | 30 | Source5: http://www.nginx.eu/download/%{name}.monitrc |
362f5ab2 | 31 | # Source5-md5: 1d3f5eedfd34fe95213f9e0fc19daa88 |
894ff1f7 | 32 | Source6: http://www.nginx.eu/download/%{name}.conf |
362f5ab2 | 33 | # Source6-md5: 1c112d6f03d0f365e4acc98c1d96261a |
28a25161 | 34 | Source7: %{name}.logrotate |
f1fc9780 | 35 | Patch0: %{name}-config.patch |
51ef519b | 36 | URL: http://nginx.net/ |
dfef7372 | 37 | BuildRequires: mailcap |
f9e65082 | 38 | BuildRequires: openssl-devel |
f1fc9780 | 39 | BuildRequires: pcre-devel |
7d9b86c7 | 40 | BuildRequires: rpmbuild(macros) >= 1.268 |
f9e65082 | 41 | BuildRequires: zlib-devel |
7d9b86c7 ER |
42 | Requires(post,preun): /sbin/chkconfig |
43 | Requires(postun): /usr/sbin/groupdel | |
44 | Requires(postun): /usr/sbin/userdel | |
45 | Requires(pre): /bin/id | |
46 | Requires(pre): /usr/bin/getgid | |
47 | Requires(pre): /usr/sbin/groupadd | |
48 | Requires(pre): /usr/sbin/useradd | |
aba2d783 | 49 | Requires: rc-scripts >= 0.2.0 |
ee547c00 | 50 | Provides: group(http) |
51 | Provides: group(nginx) | |
52 | Provides: user(nginx) | |
e46a995c | 53 | Conflicts: logrotate < 3.7.4 |
f9e65082 ER |
54 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
55 | ||
362f5ab2 | 56 | %define _sysconfdir /etc/%{name} |
57 | %define _nginxdir /home/services/%{name} | |
f9e65082 ER |
58 | |
59 | %description | |
894ff1f7 ER |
60 | Nginx ("engine x") is a high-performance HTTP server and reverse |
61 | proxy, as well as an IMAP/POP3 proxy server. Nginx was written by Igor | |
62 | Sysoev for Rambler.ru, Russia's second-most visited website, where it | |
63 | has been running in production for over two and a half years. Igor has | |
64 | released the source code under a BSD-like license. Although still in | |
65 | beta, Nginx is known for its stability, rich feature set, simple | |
66 | configuration, and low resource consumption. | |
8e1389c7 | 67 | |
390f5b88 JR |
68 | %description -l pl.UTF-8 |
69 | Serwer HTTP i odwrotne proxy o wysokiej wydajności. | |
f9e65082 | 70 | |
28a25161 | 71 | |
72 | %package -n monit-rc-nginx | |
73 | Summary: Nginx support for monit | |
74 | Summary(pl.UTF-8): Wsparcie nginx dla monit | |
75 | Group: Applications/System | |
76 | Requires: %{name} = %{version}-%{release} | |
77 | Requires: monit | |
78 | ||
79 | %description -n monit-rc-nginx | |
80 | monitrc file for monitoring nginx webserver server. | |
81 | ||
82 | %description -n monit-rc-nginx -l pl.UTF-8 | |
ee4f2132 | 83 | Plik monitrc do monitorowania serwera www nginx. |
28a25161 | 84 | |
85 | ||
f9e65082 ER |
86 | %prep |
87 | %setup -q | |
f1fc9780 | 88 | %patch0 -p0 |
f9e65082 | 89 | |
dfef7372 ER |
90 | # build mime.types.conf |
91 | sh %{SOURCE2} /etc/mime.types | |
92 | ||
f9e65082 ER |
93 | %build |
94 | # NB: not autoconf generated configure | |
95 | ./configure \ | |
96 | --prefix=%{_prefix} \ | |
97 | --sbin-path=%{_sbindir}/%{name} \ | |
98 | --conf-path=%{_sysconfdir}/%{name}.conf \ | |
99 | --error-log-path=%{_localstatedir}/log/%{name}/error.log \ | |
100 | --pid-path=%{_localstatedir}/run/%{name}.pid \ | |
dfef7372 ER |
101 | --user=nginx \ |
102 | --group=nginx \ | |
362f5ab2 | 103 | %{?with_stub_status:--with-http_stub_status_module} \ |
104 | %{?with_rtsig:--with-rtsig_module} \ | |
105 | %{?with_select:--with-select_module} \ | |
106 | %{?with_poll:--with-poll_module} \ | |
107 | %{?with_ssl:--with-http_ssl_module} \ | |
108 | %{?with_imap:--with-imap} \ | |
ee4f2132 | 109 | %{!?with_http_browser:--without-http_browser_module} \ |
f9e65082 ER |
110 | --http-log-path=%{_localstatedir}/log/%{name}/access.log \ |
111 | --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \ | |
112 | --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \ | |
113 | --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \ | |
f9e65082 ER |
114 | --with-cc="%{__cc}" \ |
115 | --with-cc-opt="%{rpmcflags}" \ | |
116 | --with-ld-opt="%{rpmldflags}" \ | |
117 | %{?debug:--with-debug} | |
118 | ||
119 | %{__make} | |
120 | ||
121 | %install | |
122 | rm -rf $RPM_BUILD_ROOT | |
362f5ab2 | 123 | install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \ |
124 | $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \ | |
125 | $RPM_BUILD_ROOT{%{_localstatedir}/log/{%{name},archive/%{name}},%{_localstatedir}/cache/%{name}} \ | |
28a25161 | 126 | $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}} \ |
127 | $RPM_BUILD_ROOT/etc/{logrotate.d,monit} | |
f9e65082 | 128 | |
f1fc9780 | 129 | install conf/* $RPM_BUILD_ROOT%{_sysconfdir} |
dfef7372 | 130 | install mime.types $RPM_BUILD_ROOT%{_sysconfdir}/mime.types |
f1fc9780 | 131 | install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} |
362f5ab2 | 132 | install %{SOURCE3} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico |
cd728db7 | 133 | install html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html |
134 | install html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors | |
362f5ab2 | 135 | install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf |
28a25161 | 136 | install %{SOURCE5} $RPM_BUILD_ROOT/etc/monit/%{name}.monitrc |
362f5ab2 | 137 | install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/nginx.conf |
28a25161 | 138 | install %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name} |
057a558d | 139 | |
f1fc9780 | 140 | install objs/%{name} $RPM_BUILD_ROOT%{_sbindir}/%{name} |
f9e65082 ER |
141 | |
142 | rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.default | |
143 | rm -rf $RPM_BUILD_ROOT%{_prefix}/html | |
144 | ||
145 | %clean | |
146 | rm -rf $RPM_BUILD_ROOT | |
147 | ||
f1fc9780 | 148 | %pre |
a37373c3 | 149 | %groupadd -r -g 213 %{name} |
362f5ab2 | 150 | %groupadd -g 51 http |
a37373c3 | 151 | %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name} |
362f5ab2 | 152 | %addusertogroup %{name} http |
f1fc9780 | 153 | |
f9e65082 | 154 | %post |
362f5ab2 | 155 | for a in access.log error.log; do |
156 | if [ ! -f /var/log/%{name}/$a ]; then | |
157 | touch /var/log/%{name}/$a | |
158 | chown nginx:nginx /var/log/%{name}/$a | |
159 | chmod 644 /var/log/%{name}/$a | |
160 | fi | |
161 | done | |
f9e65082 ER |
162 | /sbin/chkconfig --add %{name} |
163 | %service %{name} restart | |
164 | ||
165 | %preun | |
166 | if [ "$1" = "0" ]; then | |
167 | %service -q %{name} stop | |
168 | /sbin/chkconfig --del %{name} | |
169 | fi | |
f9e65082 | 170 | |
f1fc9780 | 171 | %postun |
172 | if [ "$1" = "0" ]; then | |
7d9b86c7 ER |
173 | %userremove %{name} |
174 | %groupremove %{name} | |
f1fc9780 | 175 | fi |
176 | ||
f9e65082 ER |
177 | %files |
178 | %defattr(644,root,root,755) | |
179 | %doc CHANGES LICENSE README html/index.html conf/nginx.conf | |
180 | %doc %lang(ru) CHANGES.ru | |
f1fc9780 | 181 | %attr(754,root,root) /etc/rc.d/init.d/%{name} |
182 | %dir %attr(754,root,root) %{_sysconfdir} | |
164ab75d | 183 | %dir %{_nginxdir} |
184 | %dir %{_nginxdir}/cgi-bin | |
185 | %dir %{_nginxdir}/html | |
186 | %dir %{_nginxdir}/errors | |
f1fc9780 | 187 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf |
28a25161 | 188 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name} |
f1fc9780 | 189 | %attr(640,root,root) %{_sysconfdir}/*[_-]* |
362f5ab2 | 190 | %attr(640,root,root) %{_sysconfdir}/proxy.conf |
f1fc9780 | 191 | %attr(640,root,root) %{_sysconfdir}/mime.types |
192 | %attr(755,root,root) %{_sbindir}/%{name} | |
193 | %attr(770,root,%{name}) /var/cache/%{name} | |
fb1687bb | 194 | %attr(750,root,root) %dir /var/log/archive/%{name} |
f1fc9780 | 195 | %attr(750,%{name},logs) /var/log/%{name} |
475fecd1 | 196 | %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/* |
cd728db7 | 197 | %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/* |
28a25161 | 198 | |
199 | %files -n monit-rc-nginx | |
200 | %defattr(644,root,root,755) | |
201 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc |