centos7.x编译安装淘宝tengine-2.1.2
发表于:2025-12-01 作者:千家信息网编辑
千家信息网最后更新 2025年12月01日,下载所有包,jemalloc(可选)用于优化内存yum groups install "Development Tools" -yyum -y install bzip2wget -c ftp://f
千家信息网最后更新 2025年12月01日centos7.x编译安装淘宝tengine-2.1.2
下载所有包,jemalloc(可选)用于优化内存
yum groups install "Development Tools" -yyum -y install bzip2wget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gzwget -c http://www.openssl.org/source/openssl-1.0.2g.tar.gzwget -c http://www.zlib.net/zlib-1.2.11.tar.gzwget -c http://tengine.taobao.org/download/tengine-2.1.2.tar.gz#wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2tar -zxf pcre-8.40.tar.gz -C /usr/local/src/tar -zxf openssl-1.0.2g.tar.gz -C /usr/local/src/tar -zxf zlib-1.2.11.tar.gz -C /usr/local/src/tar -zxf tengine-2.1.2.tar.gz -C /usr/local/src/#tar jxvf jemalloc-3.6.0.tar.bz2 -C /usr/local/src/
1、安装pcre
mkdir /usr/local/pcrecd /usr/local/src/pcre-8.40./configure --prefix=/usr/local/pcremake -jmake install
2、安装openssl
mkdir /usr/local/opensslcd /usr/local/src/openssl-1.0.2g/./config --prefix=/usr/local/opensslmake dependmake -jmake install
vi /etc/profile
export PATH=$PATH:/usr/local/openssl/binorecho "export PATH=$PATH:/usr/local/openssl/bin" >> /etc/profile
:wq!
source /etc/profile
3、安装zlib
mkdir /usr/local/zlibcd /usr/local/src/zlib-1.2.11./configure --prefix=/usr/local/zlibmake -jmake install
4、安装Nginx
groupadd wwwuseradd -g www www -s /bin/falsecd /usr/local/src/tengine-2.1.2/#开启jemalloc内存优化./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.2g --with-zlib=/usr/local/src/zlib-1.2.11 --with-pcre=/usr/local/src/pcre-8.40 --with-jemalloc=/usr/local/src/jemalloc-3.6.0makemake install
注意:--with-openssl=/usr/local/src/openssl-1.0.2g --with-zlib=/usr/local/src/zlib-1.2.11 --with-pcre=/usr/local/src/pcre-8.40指向的是源码包解压的路径,而不是安装的路径,否则会报错
5、添加开机启动脚本
/usr/local/nginx/sbin/nginx #启动Nginx设置nginx开机启动vi /etc/rc.d/init.d/nginx #编辑启动文件添加下面内容#############################################################!/bin/sh## nginx - this script starts and stops the nginx daemon## chkconfig: - 85 15# description: Nginx is an HTTP(S) server, HTTP(S) reverse \# proxy and IMAP/POP3 proxy server# processname: nginx# config: /etc/nginx/nginx.conf# config: /usr/local/nginx/conf/nginx.conf# pidfile: /usr/local/nginx/logs/nginx.pid# Source function library.. /etc/rc.d/init.d/functions# Source networking configuration.. /etc/sysconfig/network# Check that networking is up.[ "$NETWORKING" = "no" ] && exit 0nginx="/usr/local/nginx/sbin/nginx"prog=$(basename $nginx)NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginxlockfile=/var/lock/subsys/nginxmake_dirs() {# make required directoriesuser=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`if [ -z "`grep $user /etc/passwd`" ]; thenuseradd -M -s /bin/nologin $userfioptions=`$nginx -V 2>&1 | grep 'configure arguments:'`for opt in $options; doif [ `echo $opt | grep '.*-temp-path'` ]; thenvalue=`echo $opt | cut -d "=" -f 2`if [ ! -d "$value" ]; then# echo "creating" $valuemkdir -p $value && chown -R $user $valuefifidone}start() {[ -x $nginx ] || exit 5[ -f $NGINX_CONF_FILE ] || exit 6make_dirsecho -n $"Starting $prog: "daemon $nginx -c $NGINX_CONF_FILEretval=$?echo[ $retval -eq 0 ] && touch $lockfilereturn $retval}stop() {echo -n $"Stopping $prog: "killproc $prog -QUITretval=$?echo[ $retval -eq 0 ] && rm -f $lockfilereturn $retval}restart() {#configtest || return $?stopsleep 1start}reload() {#configtest || return $?echo -n $"Reloading $prog: "killproc $nginx -HUPRETVAL=$?echo}force_reload() {restart}configtest() {$nginx -t -c $NGINX_CONF_FILE}rh_status() {status $prog}rh_status_q() {rh_status >/dev/null 2>&1}case "$1" instart)rh_status_q && exit 0$1;;stop)rh_status_q || exit 0$1;;restart|configtest)$1;;reload)rh_status_q || exit 7$1;;force-reload)force_reload;;status)rh_status;;condrestart|try-restart)rh_status_q || exit 0;;*)echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"exit 2esac############################################################:wq! #保存退出chmod 775 /etc/rc.d/init.d/nginx #赋予文件执行权限chkconfig nginx on #设置开机启动/etc/rc.d/init.d/nginx restart #重启程序在浏览器中打开服务器IP地址,会看到下面的界面,说明Nginx安装成功。
附./configure检测配置结果
#Configuration summary + using PCRE library: /usr/local/src/pcre-8.40 + using OpenSSL library: /usr/local/src/openssl-1.1.0e + md5: using OpenSSL library + sha1: using OpenSSL library + using zlib library: /usr/local/src/zlib-1.2.11 + jemalloc library is disabled #这个是我之前没有添加jemalloc内存优化的配置,这只是范例参考 nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx dso module path: "/usr/local/nginx/modules/" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
扩展阅读:
Nginx配置txt、pdf、doc、xls等文件直接下载的方法
在nginx配置文件中添加以下代码
location / {
if ($request_filename ~* ^.*?\.(txt|pdf|doc|xls)$){
add_header Content-Disposition: 'p_w_upload;';
}
}
参考:
http://www.osyunwei.com/archives/10057.html
http://blog.csdn.net/elong490/article/details/54913193
文件
配置
内存
路径
参考
成功
代码
内容
只是
地址
指向
方法
服务器
权限
浏览器
源码
界面
程序
结果
脚本
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
了解网络安全知识的重要性
软件开发素材网
县支行网络安全自查情况报告
哈密市网络安全周
简答题网络安全的危害
加拿大网络安全数据集
通信网络技术
中国生态环境部数据库
加固服务器哪家便宜
长宁区智能软件开发调试
阿里云服务器管理终端
江苏省扬州市网络安全侦查工作
网络安全远离网瘾
福田服务器维修
盘古软件开发的游戏
山东综合软件开发工业化
长沙久度网络技术有限公司
服务器经验池怎么弄
五a服务器
谷歌云的数据库管理技术
苏州阿里云数据库供应方
软件开发与销售核算
县支行网络安全自查情况报告
服务器安全狗无法启动失败
用自己电脑当服务器吗
网络技术的发展过称
时尚网络技术加盟有哪些
数据库文件导出后缀名
双代号网络技术论文
工业网络安全概述