憧憬博客Nginx到Tengine的迁移

简介: 憧憬博客Nginx到Tengine的迁移

憧憬博客Nginx到Tengine的迁移

Tengine 是由淘宝网发起的 Web 服务器项目。它在 Nginx 的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。据说 TengineIO 性能比 Nginx 提升了几十倍、淘宝流量高峰全靠 Tengine 应对。

一直在网上听说 Tengine 优秀的性能,淘宝自家都使用的 web server,其稳定性和性能已经在淘宝网,天猫商城等得到了很好的检验。这个时候博主好奇心就来了,非得把博客的 Nginx 迁移到 Tengine 不可,小小体验一下 Tengine

这里就记录一下迁移记录,其实迁移很简单,Tengine基本上继承 Nginx 的所有特性,兼容 Nginx 的配置,所以在迁移上并没花多少时间。

  • 文档资料

http://tengine.taobao.org/document/install.html

https://github.com/alibaba/tengine

安装

wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
tar -zxvf tengine-2.3.2.tar.gz
./configure
  • 出错了呀
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
apt-get install libpcre3 libpcre3-dev
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
apt-get install openssl libssl-dev
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
apt-get install zlib1g-dev

找这个 zlib 库的时候比较有意思, zlib 这个包直接安装但是不清楚包名,编译安装下载资源 Not Found,然后看到一个解决问题的思路觉得挺好, 分享给大家:

zlib 的官网打不开, apt-get insatll zlib 也找不到软件包,貌似不在软件源里?解决方法是打开 ubuntu software center ,搜索 zlib ,找到 zlib1g-dev 这个包,安装成功。 有些软件包的名字无法确定,可以借助 ubuntu software center 来确定其有效名字,

# 成功弄好配置项 这里的话如果有需要其他模块的 和 nginx是一样的,Tengine 特有的就直接上官网翻资料就可以
./configure
Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library
  + jemalloc library is disabled
  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  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 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"
make

迁移

配置脚本选项大多数选项与Nginx兼容。文档有些Tengine的特定选项,可以查看

默认安装路径 /usr/local/nginx/

因为他直接兼容 nginx,所以我直接把原来的站点引入过来 放入到配置文件

  • vi /usr/local/nginx/conf/nginx.conf
include /etc/nginx/sites-enabled/*;
  • sbin/nginx -t
nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/sites-enabled/default:67
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
  • 这里在检测配置的时候有个警告,看了一下 ssl 指令废弃了,如果使用 listen 443 ssl,删除 ssl on 就行了。
listen 443 ssl;
server_name aoppp.com;
#ssl on;


目录
打赏
0
0
0
0
28
分享
相关文章
Tengine、Nginx安装MySQL数据库命令教程
本指南详细介绍了在Linux系统上安装与配置MySQL数据库的步骤。首先通过下载并安装MySQL社区版本,接着启动MySQL服务,使用`systemctl start mysqld.service`命令。若启动失败,可尝试使用`sudo /etc/init.d/mysqld start`。利用`systemctl status mysqld.service`检查MySQL的服务状态,确保其处于运行中。通过日志文件获取初始密码,使用该密码登录数据库,并按要求更改初始密码以增强安全性。随后创建一个名为`tengine`的数据库,最后验证数据库创建是否成功以及完成整个设置流程。
Tengine、Nginx安装PHP命令教程
要在阿里云Linux上安装PHP,请先更新YUM源并启用PHP 8.0仓库,然后安装PHP及相关扩展。通过`php -v`命令验证安装成功后,需修改Nginx配置文件以支持PHP,并重启服务。最后,创建`phpinfo.php`文件测试安装是否成功。对于CentOS系统,还需安装EPEL源和Remi仓库,其余步骤类似。完成上述操作后,可通过浏览器访问`http://IP地址/phpinfo.php`测试安装结果。
Linux搭建tengine2.0<Nginx>+php7环境
本文介绍了在Linux系统上搭建Tengine 2.0(一个Nginx的增强版本)和PHP 7环境的详细步骤,包括创建安装目录、下载源码包及依赖库、编译安装Nginx、配置Nginx、安装PHP及其依赖、设置PHP-FPM、配置环境变量、安装Git和Composer,以及服务管理和日志查看等。
167 0
既然Tengine比Nginx更强大,为什么Tengine没有取代Nginx呢?
既然Tengine比Nginx更强大,为什么Tengine没有取代Nginx呢?
411 0
Tengine有没有非开源的支持nginx的steam quic协议?
【1月更文挑战第15天】【1月更文挑战第75篇】Tengine有没有非开源的支持nginx的steam quic协议?
160 10
Centos 8.0中Nginx配置文件和https正书添加配置
这是一份Nginx配置文件,包含HTTP与HTTPS服务设置。主要功能如下:1) 将HTTP(80端口)请求重定向至HTTPS(443端口),增强安全性;2) 配置SSL证书,支持TLSv1.1至TLSv1.3协议;3) 使用uWSGI与后端应用通信(如Django);4) 静态文件托管路径设为`/root/code/static/`;5) 定制错误页面(404、50x)。适用于Web应用部署场景。
491 87
Nginx配置与命令
Nginx 是一款高性能的 HTTP 和反向代理服务器,其配置文件灵活且功能强大。本文介绍了 Nginx 配置的基础结构和常用指令,包括全局块、Events 块、HTTP 块及 Server 块的配置方法,以及静态资源服务、反向代理、负载均衡、HTTPS 和 URL 重写等功能实现。此外,还提供了常用的 Nginx 命令操作,如启动、停止、重载配置和日志管理等,帮助用户高效管理和优化服务器性能。
Nginx中配置HTTP2协议的方法
Nginx中配置HTTP2协议的方法
489 7
Nginx进程配置指令详解
Nginx进程配置指令主要包括:`worker_processes`设置工作进程数;`worker_cpu_affinity`绑定CPU核心;`worker_rlimit_nofile`设置最大文件描述符数量;`worker_priority`设置进程优先级;`worker_connections`设置最大连接数;`daemon`控制守护进程模式;`master_process`启用主进程模式;`pid`设置PID文件路径;`user`指定用户和组;`error_log`配置错误日志。这些指令在`nginx.conf`中配置,用于优化和控制Nginx的运行行为。
202 10
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等