File nginx.spec of Package nginx

Name: nginx
Version: 1.25.4
Release: 1.iflybank%{?dist}
Summary: nginx [engine x] is an HTTP and  Proxy server
Vendor: http://www.iflybank.com


Group:  Applications/Archiving
Packager:   shenbin <shenb@iflybank.com>
License: GPLv2
URL:    http://www.nginx.org

Source0: nginx-1.25.4.tar.gz
Source1: logrotate-nginx
Source2: pcre-8.45.tar.gz
Source3: zlib-1.2.13.tar.gz
Source4: openssl-1.1.1w.tar.gz
Source5: nginx.service
Source6: nginx.conf
Source7: 80.conf
Source8: nginx-sticky-module_1.2.5.tar.gz


BuildRoot:  %_topdir/BUILDROOT
BuildRequires:  gcc
# Requires: openssl,openssl-devel,pcre-devel,pcre


%description
nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server, originally written by Igor Sysoev. For a long time, it has been running on many heavily loaded Russian sites including Yandex, Mail.Ru, VK, and Rambler. According to Netcraft, nginx served or proxied 25.43% busiest sites in June 2020. Here are some of the success stories: Dropbox, Netflix, Wordpress.com, FastMail.FM.

%prep
%setup -q  -n nginx-1.25.4
%setup -q -T -D -a 4 -n nginx-1.25.4
%setup -q -T -D -a 2 -n nginx-1.25.4 
%setup -q -T -D -a 3 -n nginx-1.25.4
%setup -q -T -D -a 8 -n nginx-1.25.4


%build
./configure \
--prefix=/usr/local/nginx \
--with-pcre=./pcre-8.45 \
--with-zlib=./zlib-1.2.13 \
--with-openssl=./openssl-1.1.1w \
--with-select_module \
--with-threads \
--with-file-aio \
--with-http_ssl_module \
--with-poll_module \
--with-http_v2_module  \
--with-http_realip_module  \
--with-http_sub_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-stream \
--with-stream=dynamic --with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_ssl_preread_module \
--with-debug

make %{?_smp_mflags}


%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
%{__install} -p -D -m 0755 $RPM_SOURCE_DIR/nginx.service %{buildroot}/usr/lib/systemd/system/nginx.service
%{__install} -p -D -m 0755 $RPM_SOURCE_DIR/nginx.conf %{buildroot}/usr/local/nginx/conf/nginx.conf
%{__install} -p -D -m 0755 $RPM_SOURCE_DIR/80.conf %{buildroot}/usr/local/nginx/conf/conf.d/80.conf
%{__install} -p -D -m 0644 $RPM_SOURCE_DIR/logrotate-nginx %{buildroot}/etc/logrotate.d/logrotate-nginx

%pre
if id -u nginx >/dev/null 2>&1; then
    echo "user exists"
else
    useradd -M -s /sbin/nologin nginx    
fi

%post
sed -i s#/usr/sbin/logrotate\ -s\ /var/lib/logrotate/logrotate.status\ /etc/logrotate.conf#/usr/sbin/logrotate\ -f\ /etc/logrotate.conf# /etc/cron.daily/logrotate
systemctl restart crond


%postun
if [ $1 = 0 ];then
    pkill nginx
    rm -rf /usr/local/nginx
    rm -rf /etc/logrotate.d/logrotate-nginx
    userdel  nginx
fi


%files
%defattr(-,root,root,-)
%config(noreplace) /usr/local/nginx/conf/*
/usr/local/nginx/html/
/usr/local/nginx/sbin/nginx
/usr/lib/systemd/system/nginx.service
/usr/local/nginx/logs
/etc/logrotate.d/logrotate-nginx

#%dir /var/log/nginx

%changelog
* Thu Nov 11 2021 iflybank <shenb@iflybank.com>
- 启用http2以及tcp/udp proxy功能

* Wed Sep 08 2021 iflybank <shenb@iflybank.com>
- 初次构建
openSUSE Build Service is sponsored by