分类: LINUX
2012-12-05 12:04:29
%define name nginx %define version 1.0.15 %define nginxdir /usr/local/nginx/ %define nginxinit /etc/rc.d/init.d/nginx %define nginxuser www Name : %{name} Version : %{version} Release : 1 License : GPL Group : Application/Productivity source0 : nginx-1.0.15.tar.gz source1 : nginx.init Vendor : URL : Summary : nginx is http web BuildRoot : %{_topdir}/BUILDROOT BuildRequires : gcc,pcre-devel,openssl-devel %Description nginx is http web %prep %setup -q %build ./configure \ --prefix=%{nginxdir} \ --user=www \ --group=www \ --with-http_mp4_module \ --with-http_gzip_static_module \ --with-http_stub_status_module \ --with-http_sub_module \ --with-http_ssl_module make %install %{__rm} -fr %{buildroot} make install DESTDIR="%{buildroot}" %{__rm} -fr %{buildroot}/%{nginxinit} install -p -D -m 0755 %{SOURCE1} %{buildroot}/%{nginxinit} %pre if [ $1 == 1 ] then useradd %{nginxuser} 2>/dev/null || : fi %post if [ $1 == 1 ] then /sbin/chkconfig --add %{name} fi %preun if [ $1 == 0 ] then /sbin/service %{name} stop > /dev/null 2>&1 /sbin/chkconfig --del %{name} fi %postun %clean rm -fr %{buildroot} %files %defattr(-,root,root,0755) %{nginxdir} %{nginxinit} |
%define name nginx
%define nginx_user www
%define version 1.2.6
%define release 1
%define nginx_init /etc/rc.d/init.d/nginxd
Name: %{name}
Version: %{version}
Release: %{release}
Summary: nginx is webserver
Group: Applications/Communications
License: BSD
URL:
BuildRoot: %{_topdir}/BUILDROOT
BuildRequires: pcre-devel,openssl-devel
Requires: pcre,openssl
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.init
Requires(pre): shadow-utils
Requires(post): chkconfig
#Requires(preun): shadow-utils
#Requires(postun): chkconfig
%description
nginx is webserver
%prep
%setup -q
%build
export DESTDIR=%{buildroot}
./configure \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_stub_status_module \
--sbin-path=/usr/local/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--user=%{nginx_user} \
--group=%{nginx_user}
make
%install
%{__rm} -fr %{buildroot}
make install DESTDIR=%{buildroot}
install -p -D -m 0755 %{SOURCE1} %{buildroot}/%{nginx_init}
%clean
%{__rm} -fr %{buildroot}/*
%pre
if [ $1 == 1 ]
then
/usr/sbin/useradd -d /usr/local/nginx -s /sbin/nologin %{nginx_user} 2>/dev/null || :
fi
%post
if [ $1 == 1 ]
then
/sbin/chkconfig --add nginxd
fi
%preun
if [ $1 == 0 ]
then
/sbin/service nginxd stop 2>&1 > /dev/null ||:
/sbin/chkconfig --del nginxd 2>&1 > /dev/null ||:
fi
%postun
if [ $1 == 0 ]
then
%{__rm} -fr /usr/local/nginx/
fi
%files
%defattr(-,root,root,-)
%{nginx_init}
%dir /var/log/nginx
%dir /etc/nginx
%dir /usr/local/nginx/logs
%dir /usr/local/nginx/html
/etc/nginx/mime.types.default
%config(noreplace) /etc/nginx/nginx.conf
%config(noreplace) /etc/nginx/uwsgi_params
%config(noreplace) /etc/nginx/fastcgi_params
%config(noreplace) /etc/nginx/fastcgi.conf
/etc/nginx/scgi_params.default
/etc/nginx/fastcgi.conf.default
/etc/nginx/fastcgi_params.default
/etc/nginx/nginx.conf.default
/etc/nginx/scgi_params
/etc/nginx/koi-utf
/etc/nginx/mime.types
/etc/nginx/uwsgi_params.default
/etc/nginx/koi-win
/etc/nginx/win-utf
/usr/local/nginx/html/index.html
/usr/local/nginx/html/50x.html
/etc/nginx/fastcgi.conf
/usr/local/sbin/nginx