当前位置: 首页 > news >正文

【编译打包】tengine 1.5.1 SRPM

Tengine 1.5.1是最新稳定版,打包出一个SRPM,分享给大家。


此次打包tengine的特性相对比较完整,主要是包含跟原版nginx区别开来的dso-tool

1、根据CPU数量自动设置进程数和CPU亲缘性

2、大量实用的功能模块(nginx没有,而tengine改进或者新增的模块)


tengine.spec基于nginx.spec,仅供参考,欢迎给出改进意见


#
%define nginx_home %{_localstatedir}/cache/nginx
%define nginx_user nginx
%define nginx_group nginx
Summary: tengine is a high performance web server
Name: tengine
Version: 1.5.1
Release: 1%{?dist}
Vendor: taobao inc.
URL: http://tengine.taobao.org/
Source0: http://tengine.taobao.org/download/%{name}-%{version}.tar.gz
Source1: logrotate
Source2: nginx.init
Source3: nginx.sysconf
Source4: nginx.conf
Source5: nginx.vh.default.conf
Source6: nginx.vh.example_ssl.conf
Source7: nginx.suse.init
Source8: fastcgi_params
License: 2-clause BSD-like license
%if 0%{?suse_version}
Group: Productivity/Networking/Web/Servers
%else
Group: System Environment/Daemons
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: zlib-devel
BuildRequires: pcre-devel
BuildRequires: perl
BuildRequires: gperftools-devel
%if 0%{?suse_version}
BuildRequires: libopenssl-devel
Requires(pre): pwdutils
%else
BuildRequires: openssl-devel
Requires: initscripts >= 8.36
Requires(pre): shadow-utils
Requires(post): chkconfig
%endif
Provides: webserver
%description
tengine is a fork of nginx, which is an high performance HTTP and reverse proxy server.
%package debug
Summary: debug version of tengine
Group: System Environment/Daemons
Requires: tengine
%description debug
not stripped version of tengine build with the debugging log support
%prep
%setup -q
%build
./configure \
        --prefix=%{_sysconfdir}/nginx \
        --sbin-path=%{_sbindir}/nginx \
        --conf-path=%{_sysconfdir}/nginx/nginx.conf \
        --error-log-path=%{_localstatedir}/log/nginx/error.log \
        --http-log-path=%{_localstatedir}/log/nginx/access.log \
        --pid-path=%{_localstatedir}/run/nginx.pid \
        --lock-path=%{_localstatedir}/run/nginx.lock \
        --dso-path=%{_sysconfdir}/nginx/modules \
        --dso-tool-path=%{_sbindir}/dso-tool \
        --http-client-body-temp-path=%{_localstatedir}/cache/nginx/client_temp \
        --http-proxy-temp-path=%{_localstatedir}/cache/nginx/proxy_temp \
        --http-fastcgi-temp-path=%{_localstatedir}/cache/nginx/fastcgi_temp \
        --http-uwsgi-temp-path=%{_localstatedir}/cache/nginx/uwsgi_temp \
        --http-scgi-temp-path=%{_localstatedir}/cache/nginx/scgi_temp \
        --user=%{nginx_user} \
        --group=%{nginx_group} \
        --with-http_ssl_module \
        --with-http_realip_module \
        --with-http_gzip_static_module \
        --with-http_stub_status_module \
        --with-file-aio \
        --with-http_concat_module \
        --with-http_upstream_check_module \
        --with-google_perftools_module \
        --with-debug \
        --with-cc-opt="%{optflags} $(pcre-config --cflags)" \
        $*
make %{?_smp_mflags}
%{__mv} %{_builddir}/%{name}-%{version}/objs/nginx \
        %{_builddir}/%{name}-%{version}/objs/nginx.debug
./configure \
        --prefix=%{_sysconfdir}/nginx \
        --sbin-path=%{_sbindir}/nginx \
        --conf-path=%{_sysconfdir}/nginx/nginx.conf \
        --error-log-path=%{_localstatedir}/log/nginx/error.log \
        --http-log-path=%{_localstatedir}/log/nginx/access.log \
        --pid-path=%{_localstatedir}/run/nginx.pid \
        --lock-path=%{_localstatedir}/run/nginx.lock \
    --dso-path=%{_sysconfdir}/nginx/modules \
    --dso-tool-path=%{_sbindir}/dso-tool \
        --http-client-body-temp-path=%{_localstatedir}/cache/nginx/client_temp \
        --http-proxy-temp-path=%{_localstatedir}/cache/nginx/proxy_temp \
        --http-fastcgi-temp-path=%{_localstatedir}/cache/nginx/fastcgi_temp \
        --http-uwsgi-temp-path=%{_localstatedir}/cache/nginx/uwsgi_temp \
        --http-scgi-temp-path=%{_localstatedir}/cache/nginx/scgi_temp \
        --user=%{nginx_user} \
        --group=%{nginx_group} \
        --with-http_ssl_module \
        --with-http_realip_module \
        --with-http_gzip_static_module \
        --with-http_stub_status_module \
        --with-file-aio \
    --with-http_concat_module \
    --with-http_upstream_check_module \
    --with-google_perftools_module \
        --with-cc-opt="%{optflags} $(pcre-config --cflags)" \
        $*
make %{?_smp_mflags}
%install
%{__rm} -rf $RPM_BUILD_ROOT
%{__make} DESTDIR=$RPM_BUILD_ROOT install
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/nginx
%{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/html $RPM_BUILD_ROOT%{_datadir}/nginx/
%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/nginx/*.default
%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/nginx/fastcgi.conf
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/log/nginx
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/run/nginx
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/cache/nginx
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/nginx/modules
%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/nginx.conf
%{__install} -m 644 -p %{SOURCE4} \
   $RPM_BUILD_ROOT%{_sysconfdir}/nginx/nginx.conf
%{__install} -m 644 -p %{SOURCE5} \
   $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/default.conf
%{__install} -m 644 -p %{SOURCE6} \
   $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/example_ssl.conf
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
%{__install} -m 644 -p %{SOURCE3} \
   $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx
%{__install} -m 644 -p %{SOURCE8} \
   $RPM_BUILD_ROOT%{_sysconfdir}/nginx/fastcgi_params
# install SYSV init stuff
%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir}
%if 0%{?suse_version}
%{__install} -m755 %{SOURCE7} \
   $RPM_BUILD_ROOT%{_initrddir}/nginx
%else
%{__install} -m755 %{SOURCE2} \
   $RPM_BUILD_ROOT%{_initrddir}/nginx
%endif
# install log rotation stuff
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
%{__install} -m 644 -p %{SOURCE1} \
   $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/nginx
%{__install} -m644 %{_builddir}/%{name}-%{version}/objs/nginx.debug \
   $RPM_BUILD_ROOT%{_sbindir}/nginx.debug
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_sbindir}/nginx
%{_sbindir}/dso-tool
%dir %{_sysconfdir}/nginx
%dir %{_sysconfdir}/nginx/conf.d
%dir %{_sysconfdir}/nginx/modules
%config(noreplace) %{_sysconfdir}/nginx/nginx.conf
%config(noreplace) %{_sysconfdir}/nginx/conf.d/default.conf
%config(noreplace) %{_sysconfdir}/nginx/conf.d/example_ssl.conf
%config(noreplace) %{_sysconfdir}/nginx/mime.types
%config(noreplace) %{_sysconfdir}/nginx/fastcgi_params
%config(noreplace) %{_sysconfdir}/nginx/scgi_params
%config(noreplace) %{_sysconfdir}/nginx/uwsgi_params
%config(noreplace) %{_sysconfdir}/nginx/koi-utf
%config(noreplace) %{_sysconfdir}/nginx/koi-win
%config(noreplace) %{_sysconfdir}/nginx/win-utf
%config(noreplace) %{_sysconfdir}/nginx/browsers
%config(noreplace) %{_sysconfdir}/nginx/module_stubs
%config(noreplace) %{_sysconfdir}/logrotate.d/nginx
%config(noreplace) %{_sysconfdir}/sysconfig/nginx
%{_initrddir}/nginx
%dir %{_datadir}/nginx
%dir %{_datadir}/nginx/html
%{_datadir}/nginx/html/*
%attr(0755,root,root) %dir %{_localstatedir}/cache/nginx
%attr(0755,root,root) %dir %{_localstatedir}/log/nginx
%files debug
%attr(0755,root,root) %{_sbindir}/nginx.debug
%pre
# Add the "nginx" user
getent group %{nginx_group} >/dev/null || groupadd -r %{nginx_group}
getent passwd %{nginx_user} >/dev/null || \
    useradd -r -g %{nginx_group} -s /sbin/nologin \
    -d %{nginx_home} -c "nginx user"  %{nginx_user}
exit 0
%post
# Register the nginx service
if [ $1 -eq 1 ]; then
    /sbin/chkconfig --add nginx
    # print site info
    cat <<BANNER
----------------------------------------------------------------------
Thanks for using Tengine!
Check out our community web site:
* http://tengine.taobao.org
If you have questions about Tengine please visit:
* http://tengine.taobao.org/faq.html
----------------------------------------------------------------------
BANNER
    # Touch and set permisions on default log files on installation
    if [ -d %{_localstatedir}/log/nginx ]; then
        if [ ! -e %{_localstatedir}/log/nginx/access.log ]; then
            touch %{_localstatedir}/log/nginx/access.log
            %{__chmod} 640 %{_localstatedir}/log/nginx/access.log
            %{__chown} nginx:adm %{_localstatedir}/log/nginx/access.log
        fi
        if [ ! -e %{_localstatedir}/log/nginx/error.log ]; then
            touch %{_localstatedir}/log/nginx/error.log
            %{__chmod} 640 %{_localstatedir}/log/nginx/error.log
            %{__chown} nginx:adm %{_localstatedir}/log/nginx/error.log
        fi
    fi
fi
%preun
if [ $1 -eq 0 ]; then
    /sbin/service nginx stop > /dev/null 2>&1
    /sbin/chkconfig --del nginx
fi
%postun
if [ $1 -ge 1 ]; then
    /sbin/service nginx upgrade &>/dev/null || :
fi
%changelog
* Sat Sep 14 2013 Purple Grape <purplegrape4@gmail.com>
- update to 1.5.1
* Wed Apr 29 2013 Purple Grape <purplegrape4@gmail.com>
- 3 modules added: http_concat_module http_upstream_check_module google_perftools_module
- 1.3.0

跟上次一样,安装需要 gperftools-libs


tengine 有个命令跟apache相似,列出已安装的模块,nginx -m输出如下

# nginx -m
Tengine version: Tengine/1.5.1 (nginx/1.2.9)
loaded modules:
    ngx_core_module (static)
    ngx_errlog_module (static)
    ngx_conf_module (static)
    ngx_dso_module (static)
    ngx_syslog_module (static)
    ngx_events_module (static)
    ngx_event_core_module (static)
    ngx_epoll_module (static)
    ngx_procs_module (static)
    ngx_proc_core_module (static)
    ngx_openssl_module (static)
    ngx_regex_module (static)
    ngx_http_module (static)
    ngx_http_core_module (static)
    ngx_http_log_module (static)
    ngx_http_upstream_module (static)
    ngx_http_static_module (static)
    ngx_http_gzip_static_module (static)
    ngx_http_autoindex_module (static)
    ngx_http_index_module (static)
    ngx_http_concat_module (static)
    ngx_http_auth_basic_module (static)
    ngx_http_access_module (static)
    ngx_http_limit_conn_module (static)
    ngx_http_limit_req_module (static)
    ngx_http_realip_module (static)
    ngx_http_geo_module (static)
    ngx_http_map_module (static)
    ngx_http_split_clients_module (static)
    ngx_http_referer_module (static)
    ngx_http_rewrite_module (static)
    ngx_http_ssl_module (static)
    ngx_http_proxy_module (static)
    ngx_http_fastcgi_module (static)
    ngx_http_uwsgi_module (static)
    ngx_http_scgi_module (static)
    ngx_http_memcached_module (static)
    ngx_http_empty_gif_module (static)
    ngx_http_browser_module (static)
    ngx_http_user_agent_module (static)
    ngx_http_upstream_ip_hash_module (static)
    ngx_http_upstream_consistent_hash_module (static)
    ngx_http_upstream_check_module (static)
    ngx_http_upstream_least_conn_module (static)
    ngx_http_upstream_keepalive_module (static)
    ngx_http_stub_status_module (static)
    ngx_http_write_filter_module (static)
    ngx_http_header_filter_module (static)
    ngx_http_chunked_filter_module (static)
    ngx_http_range_header_filter_module (static)
    ngx_http_gzip_filter_module (static)
    ngx_http_postpone_filter_module (static)
    ngx_http_ssi_filter_module (static)
    ngx_http_charset_filter_module (static)
    ngx_http_userid_filter_module (static)
    ngx_http_footer_filter_module (static)
    ngx_http_trim_filter_module (static)
    ngx_http_headers_filter_module (static)
    ngx_http_upstream_session_sticky_module (static)
    ngx_http_copy_filter_module (static)
    ngx_http_range_body_filter_module (static)
    ngx_http_not_modified_filter_module (static)
    ngx_google_perftools_module (static)



配置文件略有修改,仅供参考,

模块目前全部静态编译,因为有dso-tool,可动态载入新编译的模块,也可根据需要修改SRPM或二次打包。


附件源名称为tengine-1.5.1-1.el6.src.rpm,上传时直接添加了zip后缀,下载后请改回原来的名字。


( follow the link of " tengine-1.5.1-1.el6.src.rpm",you may get a zip file,

just like "1330104_1379093530.zip",

please directly rename it to “tengine-1.5.1-1.el6.src.rpm”

it's not really a zip file but due to the naming limitation of the blog system )










本文转自 紫色葡萄 51CTO博客,原文链接:http://blog.51cto.com/purplegrape/1296930,如需转载请自行联系原作者

相关文章:

  • Android中文API(130) —— Html
  • PHP7 学习笔记(十)会话控制
  • 压力测试的轻量级具体做法
  • 朝着微服务的方向去做一次数据库拆分
  • apache 开机自启动
  • MongoDB的监控首选:mongostat
  • 采用交换机和HUB连接局域网有什么区别?
  • 进行高效数字化转型工作的7个习惯
  • Microsoft Dynamics AX 2012 正式版虚拟机
  • Python学习笔记-实现探测Web服务质量
  • 隐藏文件无法取消隐藏属性的解决[转]
  • 缓存DNS
  • 如何对C++虚基类构造函数
  • echars 动态加载数据
  • How The Kernel Manages Your Memory
  • .pyc 想到的一些问题
  • [译]如何构建服务器端web组件,为何要构建?
  • CSS 提示工具(Tooltip)
  • extract-text-webpack-plugin用法
  • FastReport在线报表设计器工作原理
  • HTTP中的ETag在移动客户端的应用
  • Java|序列化异常StreamCorruptedException的解决方法
  • Javascript Math对象和Date对象常用方法详解
  • JavaScript设计模式之工厂模式
  • leetcode388. Longest Absolute File Path
  • Linux链接文件
  • mongo索引构建
  • mysql 5.6 原生Online DDL解析
  • mysql innodb 索引使用指南
  • Python爬虫--- 1.3 BS4库的解析器
  • React-flux杂记
  • 初探 Vue 生命周期和钩子函数
  • 分类模型——Logistics Regression
  • 容器服务kubernetes弹性伸缩高级用法
  • 以太坊客户端Geth命令参数详解
  • 再谈express与koa的对比
  • MyCAT水平分库
  • ​什么是bug?bug的源头在哪里?
  • #define与typedef区别
  • #stm32整理(一)flash读写
  • (C语言)求出1,2,5三个数不同个数组合为100的组合个数
  • (function(){})()的分步解析
  • (SpringBoot)第二章:Spring创建和使用
  • (附源码)计算机毕业设计SSM保险客户管理系统
  • (附源码)计算机毕业设计大学生兼职系统
  • (九)c52学习之旅-定时器
  • ***详解账号泄露:全球约1亿用户已泄露
  • .locked1、locked勒索病毒解密方法|勒索病毒解决|勒索病毒恢复|数据库修复
  • .NET Core6.0 MVC+layui+SqlSugar 简单增删改查
  • .net oracle 连接超时_Mysql连接数据库异常汇总【必收藏】
  • .net 开发怎么实现前后端分离_前后端分离:分离式开发和一体式发布
  • .NET/C# 使用 SpanT 为字符串处理提升性能
  • /var/log/cvslog 太大
  • ;号自动换行
  • @entity 不限字节长度的类型_一文读懂Redis常见对象类型的底层数据结构