Nginx packaged into rpm

Source: Internet
Author: User

Name:nginx
version:1.7.3
Release:12%{?dist}
Summary:a free,open-source,high-performance HTTP Server

Group:system environment/daemons
License:bsd
url:http://rolin.com/
Source0:http://aa.com/nginx/%{name}-%{version}.tar.gz
Source1:nginx.sysinit
Source2:fastcgi_params
Source3:nginx.conf
Source4:ngx_cache_purge-2.3.tar.gz
BuildRoot:% (Mktemp-ud%{_tmppath}/%{name}-%{version}-%{release}-xxxxxx)

Buildrequires:pcre-devel,zlib-devel,openssl-devel,libxslt-devel,gd-devel,gcc,make
Requires:pcre,openssl,gd
%description
Nginx is a free,open-source,high-performanc HTTP sever and reverse proxy.

%prep
%setup-q
#cd%_topdir/sources/
#tar XF nginx-1.7.3.tar.gz
#cd nginx-1.7.3


%build
Export Destdir=%{buildroot}
#cd $RPM _source_dir/nginx-1.7.3
./configure--prefix=/usr/local/nginx--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp-- Http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp--http-scgi-temp-path=/var/cache/nginx/scgi_temp--user=nginx-- Group=nginx--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-http_spdy_ Module--with-cc-opt= '-o2-g-pipe-wp,-d_fortify_source=2-fexceptions-fstack-protector--param=ssp-buffer-size=4- M64-mtune=generic '--add-module= $RPM _source_dir/ngx_cache_purge-2.3
#./configure--prefix=/usr/local/nginx--user=www--group=www--with-http_ssl_module
sudo make%{?_smp_mflags}


%install
sudo rm-rf%{buildroot}
#sudo cp-f ${sources}/nginx.conf/usr/local/nginx/conf

sudo make install destdir=%{buildroot}
#cd $RPM _source_dir/nginx-1.7.3
#make Destdir=%{buildroot} Install
%{__install}-p-d-M 0755%{source1}%{buildroot}/usr/local/nginx/sbin
MV%{buildroot}/usr/local/nginx/conf/fastcgi_params%{buildroot}/usr/local/nginx/conf/fastcgi_params.origin
%{__install}-p-d-M 0644%{source2}%{buildroot}/usr/local/nginx/conf
MV%{buildroot}/usr/local/nginx/conf/nginx.conf%{buildroot}/usr/local/nginx/conf/nginx.conf.origin
%{__install}-p-d-M 0644%{source3}%{buildroot}/usr/local/nginx/conf
%pre
#if [= = 1];then
#/usr/sbin/useradd-r Www-s/sbin/nologin 2 >/dev/null
#fi
%post
#if [= = 1];then
#/sbin/chkconfig--add%{name}
#/sbin/chkconfig%{name} on
#fi
Chroot_dir=/data/web_chroot
Mkdir-p $chroot _dir/{etc,dev,var,usr,usr/local/nginx,tmp,var/tmp,lib64,lib,bin}
/bin/mknod-m 0666 $chroot _dir/dev/null C 1 3
/bin/mknod-m 0666 $chroot _dir/dev/random C 1 8
/bin/mknod-m 0444 $chroot _dir/dev/urandom C 1 9
/bin/cp-farvp/usr/local/nginx/* $chroot _dir/usr/local/nginx
/bin/cp-rfv/lib64/* $chroot _dir/lib64/
/bin/cp-rvf/lib/* $chroot _dir/lib/
/BIN/CP-RFV/BIN/{BASH,SH} $chroot _dir/bin/
/BIN/CP-RF n2chroot/usr/bin/&& chmod +x/usr/bin/n2chroot
N2chroot/usr/local/nginx/sbin/nginx
Cp-fv/etc/{group,prelink.cache,services,adjtime,shells,gshadow,shadow,hosts.deny,localtime,nsswitch.conf, nscd.conf,prelink.conf,protocols,hosts,passwd,ld.so.cache,ld.so.conf,resolv.conf,host.conf} $chroot _dir/etc
CP-AVR/ETC/{LD.SO.CONF.D,PRELINK.CONF.D} $chroot _dir/etc
/bin/sed-i '/\/home\/www/!d ' $chroot _dir/etc/passwd
/bin/sed-i '/www/!d ' $chroot _dir/etc/group
/bin/sed-i '/www/!d ' $chroot _dir/etc/shadow
/bin/sed-i '/www/!d ' $chroot _dir/etc/gshadow

Killall Nginx
Htpasswd-m-b-c $chroot _dir/usr/local/nginx/.passwd.db s6umfc1kls qkddl5c0qdok3dle8eed9evfaiklkg
/usr/sbin/chroot/$chroot _dir/usr/local/nginx/sbin/nginx
Echo '/usr/sbin/chroot/data/web_chroot//usr/local/nginx/sbin/nginx ' >>/etc/rc.local
%preun
Msg= ' PS aux|grep nginx|grep-v "grep"
If [-Z MSG];then
Killall Nginx 1 >/dev/null 2>/dev/null
Fi
%postun
RM-RF%{prefix}



%clean
sudo rm-rf%{buildroot}

%files
%defattr (-,root,root,-)
/usr/local/nginx
%doc LICENSE Changes README
%dir/usr/local/nginx/logs
%dir/usr/local/nginx
%config (Noreplace)/usr/local/nginx/conf/win-utf
%config (Noreplace)/usr/local/nginx/conf/mime.types.default
%config (Noreplace)/usr/local/nginx/conf/fastcgi.conf
%config (Noreplace)/usr/local/nginx/conf/fastcgi.conf.default
%config (Noreplace)/usr/local/nginx/conf/fastcgi_params
%config (Noreplace)/usr/local/nginx/conf/fastcgi_params.default
%config (Noreplace)/usr/local/nginx/conf/%{name}.conf
%config (Noreplace)/usr/local/nginx/conf/mime.types
%config (Noreplace)/usr/local/nginx/conf/scgi_params
%config (Noreplace)/usr/local/nginx/conf/scgi_params.default
%config (Noreplace)/usr/local/nginx/conf/uwsgi_params
%config (Noreplace)/usr/local/nginx/conf/uwsgi_params.default
%config (Noreplace)/usr/local/nginx/conf/koi-win
%config (Noreplace)/usr/local/nginx/conf/koi-utf
%config (Noreplace)/usr/local/nginx/conf/%{name}.conf.default
%config (Noreplace)/usr/local/nginx/conf/fastcgi_params.origin
%config (Noreplace)/usr/local/nginx/conf/nginx.conf.origin





/usr/local/nginx/html/50x.html
/usr/local/nginx/html/index.html
/usr/local/nginx/sbin/nginx
#%attr (0755,root,root)%{_initrddir}/%{name}
%attr (0755,root,root)/usr/local/nginx/sbin



%changelog
* Wed APR Rolin <[email protected]>-1
-Add Nginx.sysinit
* Wed APR Rolin <[email protected]>-1
-Add paramscgi
* Wed APR Rolin <[email protected]>-1
-Add nginx.conf



Wed APR Rolin <[email protected]>-1.7.3

This article is from the "Automation Rolin" blog, so be sure to keep this source http://luoguoling.blog.51cto.com/1568501/1639291

Nginx packaged into rpm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.