共计 5787 个字符,预计需要花费 15 分钟才能阅读完成。
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 处理器 |
磁盘分区 | 对磁盘分区无要求 |
操作系统要求
我的项目 | 版本 |
---|---|
openEuler | openEuler 20.03 LTS SP1 aarch64 |
Kernel | 4.19.90-2003.4.0.0036.oe1.aarch64 |
装置操作系统
请参考:20.03 LTS SP1 装置指南
查看以后零碎版本信息
[[email protected] ~]# cat /etc/os-release
NAME="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 x2openEuler
x2openEuler 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.rpm
Verifying... ################################# [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]# ls
conf html include logs modules sbin
运行和验证
配置 HTTPS 性能
生成证书
[[email protected] tengine-nginx]# openssl genrsa -des3 -out server_2048.key 2048
Generating 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.key
Enter pass phrase for server_2048.key:
writing RSA key
[[email protected] tengine-nginx]# openssl req -new -key server_2048.key -out server_2048.csr
You are about to be asked to enter information that will be incorporated
into 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 blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN
State 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' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
[[email protected] tengine-nginx]# openssl rsa -in server_2048.key -out server_2048.key
writing RSA key
[[email protected] tengine-nginx]# openssl x509 -req -days 365 -in server_2048.csr -signkey server_2048.key -out server_2048.crt
Signature ok
subject=C = CN, ST = Some-State, O = Internet Widgits Pty Ltd
Getting Private key
[[email protected] tengine-nginx]# ls
conf 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 nginx
root 5710 1 0 17:25 ? 00:00:00 nginx: master process /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.conf
nobody 5711 5710 0 17:25 ? 00:00:00 nginx: worker process
root 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.conf
nginx: [crit] ngx_slab_alloc() failed: no memory
nginx: [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 nginx
root 5710 1 0 17:25 ? 00:00:00 nginx: master process /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.conf
nobody 5711 5710 0 17:25 ? 00:00:00 nginx: worker process
root 5713 1407 0 17:25 pts/0 00:00:00 grep --color=auto nginx
相干链接:
- openEuler 官网:www.openeuler.org/
- OS 迁徙专区: https://www.openeuler.org/zh/…
- openEuler 兼容性列表:https://www.openeuler.org/zh/…
- openEuler 迁徙指南:https://www.openeuler.org/zh/…