天天看點

憧憬部落格Nginx到Tengine的遷移憧憬部落格Nginx到Tengine的遷移

憧憬部落格Nginx到Tengine的遷移

Tengine

是由淘寶網發起的

Web

伺服器項目。它在

Nginx

的基礎上,針對大通路量網站的需求,添加了很多進階功能和特性。據說

Tengine

IO

性能比

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;           

複制

憧憬部落格Nginx到Tengine的遷移憧憬部落格Nginx到Tengine的遷移