1. 程式人生 > >CentOS 6.5 下 Tengine 安裝記錄

CentOS 6.5 下 Tengine 安裝記錄

Tengine是由淘寶網發起的Web伺服器專案。它在Nginx的基礎上,針對大訪問量網站的需求,添加了很多高階功能和特性。Tengine的效能和穩定性已經在大型的網站如淘寶網,天貓商城等得到了很好的檢驗。它的最終目標是打造一個高效、穩定、安全、易用的Web平臺。

官網:

http://tengine.taobao.org/index_cn.html


下載原始碼

wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz

解壓

tar -zxvf tengine-2.1.2.tar.gz

配置

進入目錄
cd tengine-2.1.2
./configure 

執行配置命令時,由於我的環境原因遇到以下幾個錯誤,點選連結可檢視解決方法:

安裝

make && make install
最後部分輸出:
test -f 'src/http/ngx_http_request.h' && cp 'src/http/ngx_http_request.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_config.h' && cp 'src/http/ngx_http_config.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_core_module.h' && cp 'src/http/ngx_http_core_module.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_cache.h' && cp 'src/http/ngx_http_cache.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_variables.h' && cp 'src/http/ngx_http_variables.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_script.h' && cp 'src/http/ngx_http_script.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_upstream.h' && cp 'src/http/ngx_http_upstream.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_upstream_round_robin.h' && cp 'src/http/ngx_http_upstream_round_robin.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_busy_lock.h' && cp 'src/http/ngx_http_busy_lock.h' '/usr/local/nginx/include'
test -f 'src/http/modules/ngx_http_ssi_filter_module.h' && cp 'src/http/modules/ngx_http_ssi_filter_module.h' '/usr/local/nginx/include'
test -f 'src/http/modules/ngx_http_ssl_module.h' && cp 'src/http/modules/ngx_http_ssl_module.h' '/usr/local/nginx/include'
test -f 'src/http/modules/ngx_http_reqstat.h' && cp 'src/http/modules/ngx_http_reqstat.h' '/usr/local/nginx/include'
test -f 'objs/ngx_auto_headers.h'  && cp 'objs/ngx_auto_headers.h' '/usr/local/nginx/include'
test -f 'objs/ngx_auto_config.h' && cp 'objs/ngx_auto_config.h' '/usr/local/nginx/include'
make[1]: Leaving directory `/opt/tengine-2.1.2'

修改配置檔案:

vi /usr/local/nginx/conf/nginx.conf

啟動服務:

/usr/local/nginx/sbin/nginx

訪問:

開啟瀏覽器,輸入以下地址訪問吧:
http://你的伺服器IP/
如果你修改了埠號,記得在後面加上埠
http://你的伺服器IP:88/

開放防火牆埠

如果你通過以上地址訪問不了的話,通常是防火牆的原因!

/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/init.d/iptables save

再次訪問,看到了嗎?


配置開機啟動

vi /etc/rc.d/rc.local
在檔案末尾新增“/usr/local/nginx/sbin/nginx”

常用命令:

重新載入配置檔案:/usr/local/nginx/sbin/nginx -s reload
停止服務:/usr/local/nginx/sbin/nginx -s stop
其它命令:
/usr/local/nginx/sbin/nginx -h  
nginx version: nginx/1.7.5  
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]  
  
Options:  
  -?,-h         : this help  
  -v            : show version and exit  
  -V            : show version and configure options then exit  
  -t            : test configuration and exit  
  -q            : suppress non-error messages during configuration testing  
  -s signal     : send signal to a master process: stop, quit, reopen, reload  
  -p prefix     : set prefix path (default: /usr/local/nginx/)  
  -c filename   : set configuration file (default: conf/nginx.conf)  
  -g directives : set global directives out of configuration file  

檔案許可權問題:
有可能因為目錄、檔案許可權過高,導致無權訪問檔案,可以通過以下命令修改許可權:
chmod -R 777 ./uploadfile

結束語

一路裝下來發現,就是外表的名字變了,內部還都是Nginx,可以完全按照Nginx的安裝方式來安裝。

同樣,你按照這個來安裝Nginx也沒有問題。