Install rpmbuild, generate a directory, and write a spec file with your own spec file. Due to the company's needs, nginx needs to add Lua and other dependent packages, and then packages the RPM through the compilation process. The red part is the name: nginx added based on the Compilation result.
Version: 1.2.7
Release: 1% {? Dist}
Summary: a free, open-source, high-performance HTTP server and reverse proxy.
GROUP: system enviroment/daemons
License: BSD
URL: http://www.nginx.org
Source0: http://sysoev.ru/nginx/nginx-?#version=.tar.gz
Buildroot: % (mktemp-ud % {_ tmppath}/% {name}-% {version}-% {release}-xxxxxx)
Buildrequires: OpenSSL-devel, Lua-devel
Requires: OpenSSL, Lua
% Description
Nginx is a free, open-source, high-performance HTTP server and reverse proxy,
As well as an IMAP/POP3 Proxy Server. nginx is known for its high
Performance, stability, rich feature set, simple configuration, and low
Resource consumption.
% Prep
% Setup-Q
% Build
Export destdir = % {buildroot}
. /Configure -- user = WWW -- group = WWW -- prefix =/usr/local/nginx -- PID-Path =/var/run/nginx. PID -- lock-Path =/var/run/nginx. lock -- with-http_stub_status_module -- with-http_ssl_module -- with-http_realip_module -- with-http_perl_module -- With-PCRE =/root/rpmbuild/sources/pcre-8.32 -- With-Debug -- add-module =/root/rpmbuild/sources/lua-nginx-module-0.9.1/ -- add-module =/root/rpmbuild/sources/ngx_devel_kit-0.2.19/-- add-module =/root/rpmbuild/sources/echo-nginx-module-0.49/
Make % {? _ Smp_mflags}
% Pre
Id WWW>/dev/null 2> & 1
Var1 = 'echo $? '
If [$ var1! = 0]; then
Groupadd WWW>/dev/null 2> & 1
Useradd www-g www>/dev/null 2> & 1
Fi
Mkdir-P/data/logs/nginx>/dev/null 2> & 1
% Installmake install destdir = % {buildroot}
Make-F/root/rpmbuild/build/nginx-1.2.7/objs/makefile installcd/root/rpmbuild/build/nginx-1.2.7/objs/src/HTTP/modules/perl & make installtest-d "% {buildroot}/usr/local/nginx" | mkdir-P "% {buildroot}/usr/local/nginx" test-d "% {buildroot}/usr/ local/nginx/sbin "| mkdir-P" % {buildroot}/usr/local/nginx/sbin "test! -F "% {buildroot}/usr/local/nginx/sbin/nginx" | mv "% {buildroot}/usr/local/nginx/sbin/nginx" "% {buildroot}/usr/local/nginx/sbin/nginx. old "CP/root/rpmbuild/build/nginx-1.2.7/objs/nginx" % {buildroot}/usr/local/nginx/sbin/nginx "test-d" % {buildroot }/ usr/local/nginx/conf "| mkdir-P" %{ buildroot}/usr/local/nginx/conf "CP/root/rpmbuild/build/nginx-1.2.7/CONF/koi -win "% {buildroot}/usr/local/nginx/conf" CP/root/rpmbuild/build/nginx-1.2.7/CONF/Koi-UTF "% {buildroot}/usr/local /nginx/conf "CP/root/rpmbuild/build/nginx-1.2.7/CONF/win-UTF" % {buildroot}/usr/local/nginx/conf "test-F" % {buildroot}/usr/local/nginx/CONF/mime. types "| CP/root/rpmbuild/build/nginx-1.2.7/CONF/mime. types "% {buildroot}/usr/local/nginx/conf" CP/root/RPM build/nginx-1.2.7/CONF/mime. types "% {buildroot}/usr/local/nginx/CONF/mime. types. default "test-F" % {buildroot}/usr/local/nginx/CONF/fastcgi_params "| CP/root/rpmbuild/build/nginx-1.2.7/CONF/fastcgi_params" % {buildroot }/usr/local/nginx/conf "CP/root/rpmbuild/build/nginx-1.2.7/CONF/fastcgi_params" % {buildroot}/usr/local/nginx/CONF/fastcgi_params.default "Test -F "% {buildroot}/usr/local/nginx/CONF/FastCGI. conf "| CP/root/rpmbuild/build/nginx-1.2.7/CONF/FastCGI. conf "% {buildroot}/usr/local/nginx/conf" CP/root/rpmbuild/build/nginx-1.2.7/CONF/FastCGI. conf "% {buildroot}/usr/local/nginx/CONF/FastCGI. conf. default "test-F" % {buildroot}/usr/local/nginx/CONF/uwsgi_params "| CP/root/rpmbuild/build/nginx-1.2.7/CONF/uwsgi_params" % {buildroot }/usr/local/nginx/conf "CP/root/rpmbuild/build/nginx-1.2.7/CONF/uwsgi_params" % {buildroot}/usr/local/nginx/CONF/uwsgi_params.default "Test -F "% {buildroot}/usr/local/nginx/CONF/scgi_params" | CP/root/rpmbuild/build/nginx-1.2.7/CONF/scgi_params "% {buildroot}/usr /local/nginx/conf "CP/root/rpmbuild/build/nginx-1.2.7/CONF/scgi_params" % {buildroot}/usr/local/nginx/CONF/scgi_params.default "test-F" % {buildroot}/usr/local/nginx/CONF/nginx. conf "| CP/root/rpmbuild/build/nginx-1.2.7/CONF/nginx. conf "% {buildroot}/usr/local/nginx/CONF/nginx. conf "CP/root/rpmbuild/build/nginx-1.2.7/CONF/nginx. conf "% {buildroot}/usr/local/nginx/CONF/nginx. conf. default "test-d"/var/run/nginx "| mkdir-P"/var/run/nginx "test-d" % {buildroot}/usr/local/nginx /logs "| mkdir-P" % {buildroot}/usr/local/nginx/logs "test-d" % {buildroot}/usr/local/nginx/html "| | CP-r/root/rpmbuild/build/nginx-1.2.7/html "% {buildroot}/usr/local/nginx" test-d "% {buildroot}/usr/local/nginx /logs "| mkdir-P" % {buildroot}/usr/local/nginx/logs "CP/root/rpmbuild/build/nginx" % {buildroot}/usr/local /nginx/CONF/nginx "CP/root/rpmbuild/build/nginx. conf "% {buildroot}/usr/local/nginx/CONF/nginx. conf. pre "CP/root/rpmbuild/build/nginx_logrotate" % {buildroot}/usr/local/nginx/CONF/nginx_logrotate"
This section is obtained from the execution of make install.
% Postcp/usr/local/nginx/CONF/nginx/etc/rc. d/init. d/nginx>/dev/null 2> & 1cp/usr/local/nginx/CONF/nginx. conf/usr/local/nginx/CONF/nginx. conf. bak>/dev/null 2> & 1cp/usr/local/nginx/CONF/nginx. conf. pre/usr/local/nginx/CONF/nginx. conf>/dev/null 2> & 1cp/usr/local/nginx/CONF/nginx_logrotate/etc/logrotate. d/nginx>/dev/null 2> & 1 chmod A + x/etc/logrotate. d/nginx>/dev/null 2> & 1 chmod A + x/etc/rc. d/init. d/nginx>/dev/null 2> & 1 chkconfig -- add nginxchkconfig nginx on/etc/init. d/nginx start
% Preunif PS aux | grep "nginx" | grep-V grep>/dev/NULL; then pkill nginx>/dev/nullfichkconfig -- del nginx
% Postunuserdel wwwrm-RF/etc/rc. d/init. d/nginxrm-RF/etc/logrotate. d/nginx
% Cleanrm-RF % {buildroot} % files/usr/local/nginx/CONF/FastCGI. conf/usr/local/nginx/CONF/FastCGI. conf. default/usr/local/nginx/CONF/fastcgi_params/usr/local/nginx/CONF/fastcgi_params.default/usr/local/nginx/CONF/Koi-UTF/usr/local/nginx/ conf/Koi-Win/usr/local/nginx/CONF/mime. types/usr/local/nginx/CONF/mime. types. default/usr/local/nginx/CONF/nginx. conf/usr/local/nginx/CONF/nginx. conf. default/usr/local/nginx/CONF/scgi_params/usr/local/nginx/CONF/scgi_params.default/usr/local/nginx/CONF/uwsgi_params/usr/local/nginx/CONF/ uwsgi_params.default/usr/local/nginx/CONF/win-UTF/usr/local/nginx/html/50x.html/usr/local/nginx/html/index.html/usr/local/nginx/ sbin/nginx/usr/lib64/perl5/perllocal. pod/usr/local/lib64/perl5/auto/nginx /. packlist/usr/local/lib64/perl5/auto/nginx. BS/usr/local/lib64/perl5/auto/nginx. so/usr/local/lib64/perl5/nginx. PM/usr/local/nginx/sbin/nginx. old/usr/local/share/man/man3/nginx.3pm/usr/local/nginx/CONF/nginx. conf. pre/usr/local/nginx/CONF/nginx_logrotate/usr/local/nginx/CONF/nginx # After rpmbuild-BB is executed, the system prompts that the missing files are added here % defattr (-, root, root,-) % Doc % DIR/usr/local/nginx/logs % DIR/var/run/nginx
% Changelog
Nginx package rpm