Tengine 2.2.2 移植指南(openEuler 20.03 LTS SP1)

Tengine 2.2.2 移植指南(openEuler 20.03 LTS SP1) 搬砖中~ 2023-11-28 12:05:41 309

介绍

简要介绍

Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。它的目的是打造一个高效、安全的Web平台。

开发语言:C

一句话描述:轻量级Web服务器

建议的版本

建议使用版本为“Tengine 2.2.2”。

说明: 本文档适用于Tengine 2.2.2,其他版本的Tengine移植步骤也可参考本文档。

环境要求

操作系统要求

安装操作系统

请参考:20.03 LTS SP1 安装指南
检查当前系统版本信息

[root@localhost ~]# 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解析文件
[root@localhost ~]# echo "nameserver 114.114.114.114" >> /etc/resolv.conf
安装依赖包
[root@localhost ~]# 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包。
[root@localhost ~]# cd /home
[root@localhost 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

[root@localhost 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%]

查看安装目录。

[root@localhost home]# cd /usr/local/tengine-nginx/
[root@localhost tengine-nginx]# ls
conf  html  include  logs  modules  sbin

运行和验证

配置HTTPS功能

生成证书

[root@localhost 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:
[root@localhost tengine-nginx]# openssl rsa -in server_2048.key -out server_2048.key
Enter pass phrase for server_2048.key:
writing RSA key
[root@localhost 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 []:
[root@localhost tengine-nginx]# openssl rsa -in server_2048.key -out server_2048.key
writing RSA key
[root@localhost 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
[root@localhost 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
[root@localhost tengine-nginx]# /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.conf
[root@localhost 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错误

[root@localhost 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.
[root@localhost tengine-nginx]#
[root@localhost tengine-nginx]# sed -i "/http {/a\check_shm_size 50m;" /usr/local/tengine-nginx/conf/nginx.conf
[root@localhost tengine-nginx]# /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.conf
[root@localhost 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

文章来源:https://www.openeuler.org/zh/blog/randy1568/Tengine%202.2.2-porting-guide.html

声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包 点赞 收藏 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
搬砖中~
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区