Tengine 2.2.2 移植指南

介绍

简要介绍

Tengine是由淘宝网发动的Web服务器我的项目。它在Nginx的根底上,针对大访问量网站的需要,增加了很多高级性能和个性。它的目标是打造一个高效、平安的Web平台。

开发语言:C

一句话形容:轻量级Web服务器

倡议的版本

倡议应用版本为“Tengine 2.2.2”。

阐明:
本文档实用于Tengine 2.2.2,其余版本的Tengine移植步骤也可参考本文档。

环境要求

硬件要求
我的项目阐明
服务器TaiShan 200服务器(型号2280)
CPU鲲鹏920 5250处理器
磁盘分区对磁盘分区无要求
操作系统要求
我的项目版本
openEuleropenEuler 20.03 LTS SP1 aarch64
Kernel4.19.90-2003.4.0.0036.oe1.aarch64
装置操作系统

请参考:20.03 LTS SP1 装置指南

查看以后零碎版本信息
[[email protected] ~]# cat /etc/os-releaseNAME="openEuler"VERSION="20.03 (LTS-SP1)"ID="openEuler"VERSION_ID="20.03"PRETTY_NAME="openEuler 20.03 (LTS-SP1)"ANSI_COLOR="0;31"
阐明:
如果是全新装置操作系统,装置形式倡议不要应用最小化装置,否则很多软件包须要手动装置,可抉择“Server with GUI”装置形式。

装置Tengine

配置dns解析文件

[[email protected] ~]# echo "nameserver 114.114.114.114" >> /etc/resolv.conf

装置依赖包

[[email protected] ~]# yum install gcc gcc-c++ make libtool zlib zlib-devel pcre pcre-devel perl-devel perl-ExtUtils-Embed wget vim -y

镜像站RPM形式装置tengine

阐明:
镜像站中的RPM包都是通过开源代码编译打包而成,而后将其上传到镜像站。

获取Tengine 2.2.2的RPM包。

[[email protected] ~]# cd /home[[email protected] home]# wget https://mirrors.huaweicloud.com/kunpeng/yum/el/7/aarch64/Packages/web/tengine-2.2.2-1.el7_4.ngx.aarch64.rpm

兼容性评估

下载x2openEuler工具
下载指引:https://www.openeuler.org/zh/other/migration/
部署工具
rpm -ivh x2openEuler-2.0.0-1.x86_64.rpm
留神:装置rpm时须要应用root用户,且目前须要网络(用于下载安装依赖)
留神:依据提醒装置依赖包如bzip2-devel等
su x2openEulerx2openEuler redis-db -init
顺次录入redis数据库的ip:127.0.0.1
端口:6379
数据库索引号(0-16):0
明码(工具会对明码加密解决):如果redis明码没有设置或者为空时,间接回车即可
x2openEuler init source_centos7.6-openEuler20.03-LTS-SP1.tar.gz
备注:x2openEuler应用rpm装置实现后会在/opt/x2openEuler目录下带有source_centos7.6-openEuler20.03-LTS-SP1.tar.gz这个默认资源包
须要反对centos8.2到openEuler20.03-LTS-SP1的评估,则需获取对应的动态资源包导入,如对应的资源包为source_centos8.2-openEuler20.03-LTS-SP1.tar.gz,导入此包命令:x2openEuler init source_centos8.2-openEuler20.03-LTS-SP1.tar.gz,请示状况抉择对应的资源包
扫描软件
x2openEuler scan tengine-2.2.2-1.el7_4.ngx.aarch64.rpm留神要剖析的移植文件须要有可能让x2openEuler用户能够读取的权限扫描实现后会在/opt/x2openEuler/output目录生成html格局的报告

查看评估后果

软件兼容性评估报告分三块内容展现软件兼容性,别离是依赖包兼容性、C/C++接口兼容性、java接口兼容性,依赖包兼容性反映了软件包装置过程中的间接依赖,非100%表明无奈正确装置;接口兼容性反映的是单个软件运行过程中对其余软件包、动静库或零碎接口的调用变动,非100%表明在某个性能调用时可能会触发异样,未调用到时可能体现失常;局部后果倡议人工复核,最终软件包应用建优先级倡议 openEuler已移植包>openEuler上人工重编译包>centos软件包。

后果:通过报告可知内部接口兼容性100%,依赖包兼容性人工复核后通过,经评估tengine2.2.2软件包在openEuler 20.03 LTS SP1零碎上兼容,可装置此软件包至openEuler 20.03 LTS SP1零碎进行验证。

装置Tengine

[[email protected] home]# rpm -ivh tengine-2.2.2-1.el7_4.ngx.aarch64.rpmVerifying...                          ################################# [100%]Preparing...                          ################################# [100%]Updating / installing...   1:tengine-1:2.2.2-1.el7_4.ngx      ################################# [100%]

查看装置目录。

[[email protected] home]# cd /usr/local/tengine-nginx/[[email protected] tengine-nginx]# lsconf  html  include  logs  modules  sbin

运行和验证

配置HTTPS性能

生成证书

[[email protected] tengine-nginx]# openssl genrsa -des3 -out server_2048.key 2048Generating RSA private key, 2048 bit long modulus (2 primes)...................................+++++..................+++++e is 65537 (0x010001)Enter pass phrase for server_2048.key:Verifying - Enter pass phrase for server_2048.key:[[email protected] tengine-nginx]# openssl rsa -in server_2048.key -out server_2048.keyEnter pass phrase for server_2048.key:writing RSA key[[email protected] tengine-nginx]# openssl req -new -key server_2048.key -out server_2048.csrYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:Locality Name (eg, city) []:Organization Name (eg, company) [Internet Widgits Pty Ltd]:Organizational Unit Name (eg, section) []:Common Name (e.g. server FQDN or YOUR name) []:Email Address []:Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:[[email protected] tengine-nginx]# openssl rsa -in server_2048.key -out server_2048.keywriting RSA key[[email protected] tengine-nginx]# openssl x509 -req -days 365 -in server_2048.csr -signkey server_2048.key -out server_2048.crtSignature oksubject=C = CN, ST = Some-State, O = Internet Widgits Pty LtdGetting Private key[[email protected] tengine-nginx]# lsconf  html  include  logs  modules  sbin  server_2048.crt  server_2048.csr  server_2048.key

配置Tengine

vim /usr/local/tengine-nginx/conf/nginx.conf

批改如下内容

    # HTTPS server    #    #server {    #    listen       443 ssl;    #    server_name  localhost;    #    <== 批改这里: 证书地位 ==>    #    ssl_certificate      /usr/local/tengine-nginx/server_2048.crt;    #    ssl_certificate_key  /usr/local/tengine-nginx/server_2048.key;    #    ssl_session_cache    shared:SSL:1m;    #    ssl_session_timeout  5m;

运行Tengine

[[email protected] tengine-nginx]# /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.conf[[email protected] tengine-nginx]# ps -ef | grep nginxroot        5710       1  0 17:25 ?        00:00:00 nginx: master process /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.confnobody      5711    5710  0 17:25 ?        00:00:00 nginx: worker processroot        5713    1407  0 17:25 pts/0    00:00:00 grep --color=auto nginx

提醒:

  • http upstream check_shm_size is too small谬误
[[email protected] tengine-nginx]# /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.confnginx: [crit] ngx_slab_alloc() failed: no memorynginx: [emerg] http upstream check_shm_size is too small, you should specify a larger size.[[email protected] tengine-nginx]#[[email protected] tengine-nginx]# sed -i "/http {/a\check_shm_size 50m;" /usr/local/tengine-nginx/conf/nginx.conf[[email protected] tengine-nginx]# /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.conf[[email protected] tengine-nginx]# ps -ef | grep nginxroot        5710       1  0 17:25 ?        00:00:00 nginx: master process /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.confnobody      5711    5710  0 17:25 ?        00:00:00 nginx: worker processroot        5713    1407  0 17:25 pts/0    00:00:00 grep --color=auto nginx

相干链接:

  1. openEuler官网:www.openeuler.org/
  2. OS迁徙专区: https://www.openeuler.org/zh/...
  3. openEuler兼容性列表:https://www.openeuler.org/zh/...
  4. openEuler迁徙指南:https://www.openeuler.org/zh/...