Tengine是由淘寶網發起的Web服務器項目。它在Nginx的基礎上,針對大訪問量網站的需求,添加了不少高級功能和特性。javascript
據W3Techs統計,Tengine在全球用戶量排名中位列第9。php
官網: http://tengine.taobao.org/css
線上服務器都是Tenginehtml
在官網下載最新版本java
目前最新版本是Tengine-2.1.2node
解壓軟件包,其中openssl,pcre,zlib都是最新版nginx
tar zxvf openssl-1.0.2h.tar.gz -C /usr/src/服務器
tar zxvf pcre-8.38.tar.gz -C /usr/src/app
tar zxvf zlib-1.2.8.tar.gz -C /usr/src/tcp
tar zxvf tengine-2.1.2.tar.gz -C /usr/src/
cd /usr/src/tengine-2.1.2/
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-openssl=/usr/src/openssl-1.0.2h --with-zlib=/usr/src/zlib-1.2.8 --with-pcre=/usr/src/pcre-8.38
make && make install
編輯配置文件
cd /usr/local/nginx/conf
mv nginx.conf nginx.conf.bak
vi nginx.conf
內容以下:
user www www;
worker_processes 4;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 60240;
}
# load modules compiled as Dynamic Shared Object (DSO)
#
#dso {
# load ngx_http_fastcgi_module.so;
# load ngx_http_rewrite_module.so;
#}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
proxy_read_timeout 200;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css text/xml
application/x-javascript application/xml
application/atom+xml text/javascript;
client_max_body_size 64M;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
include vhosts/*;
}
上面的文件把默認的localhost給分離出來了
服務器是4核的
編輯配置文件
vi fastcgi_params
最後一行添加
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
建立虛擬主機配置文件目錄
mkdir vhosts
建立localhost.conf文件
內容以下:
server {
listen 80;
server_name localhost;
root /usr/local/nginx/html;
index index.php index.html index.htm;
location / {
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
檢測配置文件是否ok
/usr/local/nginx/sbin/nginx -t
啓動nginx
/usr/local/nginx/sbin/nginx -s start
查看端口是否存在
netstat -anpt | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 24435/nginx
使用IP訪問頁面
http://192.168.1.110