centos7 下 安裝 tengine

源文章:http://blog.csdn.net/wlwlwlwl015 前言javascript

簡單記錄一下Linux CentOS 7中安裝與配置Tengine的詳細步驟。 簡介與安裝css

Tengine是淘寶發起的web服務器項目,簡單的講就是對nginx進行了二次開發並提供了更豐富的功能,官網地址:http://tengine.taobao.org/,目前最新的穩定版本是2.1.2,我這裏也用的這個版本,下載地址:http://tengine.taobao.org/download/tengine-2.1.2.tar.gz。廢話很少說下面開始安裝,首先將安裝文件上傳至Linux服務器後,輸入命令進行解壓:html

tar -zxvf tengine-2.1.2.tar.gzjava

解壓完成後刪除安裝包:node

rm -rf tengine-2.1.2.tar.gznginx

在安裝以前首先檢查一下是否已安裝nginx的一些模塊依賴的lib庫,諸如g++、gcc、pcre-devel、openssl-devel和zlib-devel。因此下面這些命令最好挨個跑一遍,已安裝的會提示不用安裝,未安裝或須要更新的則會執行安裝及更新:c++

yum install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl openssl-develweb

安裝完依賴後下面就能夠放心開始安裝nginx了,輸入安裝命令並指定安裝路徑:服務器

./configure --prefix=/wocloud/nginxapp

看到以下提示信息就說明沒有問題: 這裏寫圖片描述

最後經過make以及make install進行編譯安裝:

make make install

安裝完成後嘗試啓動一下,進入nginx目錄輸入啓動命令:

sbin/nginx

啓動完成後在內網的另外一外服務器嘗試訪問: 這裏寫圖片描述

出現上圖顯示的welcome字樣即成功啓動了tengine,接下來咱們修改conf目錄下的nginx.conf進行配置。 配置

關於配置不作過多詳細說明了,關於這方面的資料不少,下面給出咱們生產環境中的nginx配置以供參考:

user root; worker_processes 8; pid logs/nginx.pid; worker_rlimit_nofile 655350;

events { use epoll; worker_connections 655350; }

http { include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 164k;
fastcgi_busy_buffers_size 428k;
fastcgi_temp_file_write_size 428k;

gzip on; gzip_min_length 1k; gzip_buffers 4 16k; #gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml text/javascript image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6].";

upstream localhost{ ip_hash;

server 172.xx.1x3.69:7071 weight=2; server 172.xx.1x3.69:7072 weight=2; server 172.xx.1x3.69:7073 weight=1;

server 172.xx.1x3.70:8081 weight=2; server 172.xx.1x3.70:8082 weight=2; server 172.xx.1x3.70:8083 weight=1;

} server { listen 80; server_name localhost; location / { root html; index index.html; proxy_connect_timeout 3; proxy_send_timeout 30; proxy_read_timeout 30; proxy_pass http://localhost; }

error_page 404 /500_error.html; error_page 500 502 503 504 /500_error.html; location = /500_error.html { root html; }

location ~ .*/.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d; access_log off;
}

location ~ .*/.(js|css)?$
{
expires 30d;
access_log off; } } }

還有一點就是修改完配置不要忘了重啓nginx:

sbin/nginx -s reload

總結

簡單記錄一下Linux CentOS 7中安裝tengine的步驟和注意事項,但願對遇到一樣問題的朋友有所幫助,The End。

相關文章
相關標籤/搜索