Centos 上 Tengine安装
安装步骤:
1.系统环境
1.1 更新系统
[root@centos ~]# yum update -y
1.2 查看环境
[root@centos ~]# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
2.安装tengine
2.1.准备安装
[root@centos ~]# cd /usr/local/src/
下载pcre-8.39.tar.gz
下载zlib-1.2.8.tar.gz
下载openssl-1.0.1h.tar.gz
下载jemalloc-3.6.0.tar.bz2
下载 tengine-2.1.2.tar.gz
[root@centos ~]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
[root@centos ~]# wget http://zlib.net/zlib-1.2.8.tar.gz
[root@centos ~]# wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz
[root@centos ~]# wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2
[root@centos ~]# wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz
2.2 更新包
[root@centos ~]# yum install zlib-devel openssl-devel -y
2.3 安装Pcre
[root@centos ~]# cd /usr/local/src/
[root@centos ~]# tar zvxf pcre-8.39.tar.gz
[root@centos ~]# cd pcre-8.39
[root@centos ~]# ./configure
[root@centos ~]# make && make install
2.4 安装openssl
[root@centos ~]# cd /usr/local/src/
[root@centos ~]# tar zvxf openssl-1.0.1h.tar.gz
[root@centos ~]# cd openssl-1.0.1h
[root@centos ~]# ./config
[root@centos ~]# make && make install
2.5 安装zlib
[root@centos ~]# cd /usr/local/src/
[root@centos ~]# tar zvxf zlib-1.2.8.tar.gz
[root@centos ~]# cd zlib-1.2.8
[root@centos ~]# ./configure
[root@centos ~]# make && make install
2.6 安装jemalloc
[root@centos ~]# cd /usr/local/src/
[root@centos ~]# tar jvxf jemalloc-3.6.0.tar.bz2
[root@centos ~]# cd jemalloc-3.6.0
[root@centos ~]# ./configure
[root@centos ~]# make && make install
[root@centos ~]# echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig
4.4 创建www用户和组,创建www虚拟主机使用的目录,以及Nginx使用的日志目录,并且赋予他们适当的权限
[root@centos ~]# groupadd www
[root@centos ~]# useradd -g www www
[root@centos ~]# mkdir -p /data/www
[root@centos ~]# chmod +w /data/www
[root@centos ~]# chown -R www:www /data/www
4.5 安装tengine
[root@centos ~]# cd /usr/local/src/
[root@centos ~]# tar zvxf tengine-2.1.2.tar.gz
[root@centos ~]# cd /usr/local/src/tengine-2.1.2/src/core
伪装服务器信息(可以不修改)
[root@centos ~]# vim nginx.h
修改NGINX_VERSION为你希望显示的版号
修改NGINX_VER为你希望显示的名称
修改NGINX_VAR 为你希望显示的名称
保存
开始安装NGINX
./configure --prefix=/opt/nginx --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.1h --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.35 --with-jemalloc
[root@centos ~]# make && make install
4.6 修改 nginx.conf
[root@centos ~]# vim /opt/nginx/conf/nginx.conf
修改前面几行为:
user www www;
worker_processes 4;
error_log logs/error.log crit;
pid logs/nginx.pid;
events{
use epoll;
worker_connections 65535;
}
4.7 测试和运行
[root@centos ~]# cd /opt/nginx
[root@centos ~]# ldconfig
[root@centos ~]# ./sbin/nginx -t
如果显示下面信息,即表示配置没问题,有问题运行下 : ldd $(which /opt/nginx/sbin/nginx)
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
输入代码运行nginx服务
[root@centos ~]# ./sbin/nginx
[root@centos ~]# ps au|grep nginx
如果显以类似下面的信息,即表示nginx已经启动
root 2013 0.0 0.0 103156 856 pts/0 S+ 03:22 0:00 grep nginx
输入代码检测是否支持加速
查看是否生效
[root@centos ~]# ps -n | grep jemalloc
ginx 2346 root mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2347 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2348 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2349 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2350 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
[root@centos ~]# curl http://localhost
4.8 打开防火墙80端口
#停止firewall
[root@centos ~]# systemctl stop firewalld.service
#禁止firewall开机启动
[root@centos ~]# systemctl disable firewalld.service
安装 iptables
[root@centos ~]# yum install iptables-services
设置防火墙规则 (增加80端口)
[root@centos ~]# vim /etc/sysconfig/iptables
打开文件,增加80端口那一行
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq #保存退出
#重启防火墙使配置生效
[root@centos ~]# systemctl restart iptables.service
#设置防火墙开机启动
[root@centos ~]# systemctl enable iptables.service
4.9 作为服务,开机后启动
[root@centos ~]# vim /usr/lib/systemd/system/tengine.service
增加以下内容
[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
:wq 保存退出
[root@centos ~]# systemctl stop tengine
[root@centos ~]# systemctl start tengine
[root@centos ~]# systemctl reload tengine
[root@centos ~]# systemctl enable tengine
[root@centos ~]# shutdown -r now
Centos 上 Tengine安装的更多相关文章
- Cacti中文版在Centos上的安装
最近老有人问Cacti中文版在哪下载啊怎么安装啊,我在这里一遍给大家讲解了:Cacti中文版在Centos上的安装 1.基本安装 cacti是运作在apache+php+mysql+net-snmp工 ...
- MongoDB 3.2 在CentOS 上的安装和配置
MongoDB 3.2 在CentOS 上的安装和配置 2016-01-06 14:41:41 发布 您的评价: 0.0 收藏 0收藏 一.安装 编辑/etc/yum.re ...
- Centos上的安装openoffice+unoconv+swftools (转)
############################## # swftools的安装 # ############################## 1.安装所需的库和组件 yum ...
- centos上yum安装异常处理
最近在centos上通过yum来安装程序,出下了以下问题: Loaded plugins: fastestmirror Setting up Install Process Loading mirro ...
- Docker(1)在CentOS上的安装与卸载
一. Docker的安装 CentOS7 上安装: 1. 卸载旧版本 $ sudo yum remove docker \ docker-client \ docker-client-latest ...
- CentOS上firefox安装flash
CentOS下firefox安装flash说明 CentOS下自带了firefox,但没有flash插件的,按它自己的提示安装不成功,需要手动安装,如下: 1.打开flash官网,http://lab ...
- centos上如何安装mysql
centos可以使用yum安装mysql 但是版本很低,且不灵活. 本文将介绍如何使用安装包安装mysql http://dev.mysql.com/downloads/mysql/ 下载mysql ...
- FastDFS在centos上的安装配置与使用
FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负载均衡的问题.特别适合以文件为载体的在线服务.(百 ...
- 转载:centos上yum安装apache+php+mysql等
1. 更新系统内核到最新. [root@linuxfei ~]#yum -y update 系统更新后,如果yum安装时提示错误信息,请执行以下命令修复. [root@linuxfei ~]#rpm ...
随机推荐
- 08.LoT.UI 前后台通用框架分解系列之——多样的Tag选择器
LOT.UI分解系列汇总:http://www.cnblogs.com/dunitian/p/4822808.html#lotui LoT.UI开源地址如下:https://github.com/du ...
- 【WCF】自定义错误处理(IErrorHandler接口的用法)
当被调用的服务操作发生异常时,可以直接把异常的原始内容传回给客户端.在WCF中,服务器传回客户端的异常,通常会使用 FaultException,该异常由这么几个东东组成: 1.Action:在服务调 ...
- 获取Canvas当前坐标系矩阵
前言 在我的另一篇博文 Canvas坐标系转换 中,我们知道了所有的平移缩放旋转操作都会影响到画布坐标系.那在我们对画布进行了一系列操作之后,怎么再知道当前矩阵数据状态呢. 具体代码 首先请看下面的一 ...
- zookeeper源码分析之三客户端发送请求流程
znode 可以被监控,包括这个目录节点中存储的数据的修改,子节点目录的变化等,一旦变化可以通知设置监控的客户端,这个功能是zookeeper对于应用最重要的特性,通过这个特性可以实现的功能包括配置的 ...
- Phantomjs+Nodejs+Mysql数据抓取(2.抓取图片)
概要 这篇博客是在上一篇博客Phantomjs+Nodejs+Mysql数据抓取(1.抓取数据) http://blog.csdn.net/jokerkon/article/details/50868 ...
- celery使用的一些小坑和技巧(非从无到有的过程)
纯粹是记录一下自己在刚开始使用的时候遇到的一些坑,以及自己是怎样通过配合redis来解决问题的.文章分为三个部分,一是怎样跑起来,并且怎样监控相关的队列和任务:二是遇到的几个坑:三是给一些自己配合re ...
- 注释生成Api文档
1.开发背景 最近一直在写dubbo接口,以前总是用word文档写接口描述然后发给别人.现在太多了,而且跟别人对接联调的人家急着用,根本没时间去写word文档.那就想想怎么用doc文档注释自动生成接口 ...
- 3种web会话管理的方式
http是无状态的,一次请求结束,连接断开,下次服务器再收到请求,它就不知道这个请求是哪个用户发过来的.当然它知道是哪个客户端地址发过来的,但是对于我们的应用来说,我们是靠用户来管理,而不是靠客户端. ...
- 简述我的SOA服务治理
SOA服务治理 1.解决业务部门服务冲突和纠纷2.版本定义与版本管理3.服务备案与服务管理4.业务监督与服务监控 SOA的战略目的 一.业务价值胜过技术策略 二.战略目标胜过具体项目的效益 三.内置的 ...
- 好好了解一下Cookie
Cookie的诞生 由于HTTP协议是无状态的,而服务器端的业务必须是要有状态的.Cookie诞生的最初目的是为了存储web中的状态信息,以方便服务器端使用.比如判断用户是否是第一次访问网站.目前最新 ...