Appearance
部署Tengine替代Nginx
Tengine是由淘宝发起的Web服务器项目,基于Nginx,兼容Nginx配置文件。
下载地址Tengine
1. 编译安装Tengine
上传源码包tengine-3.1.0.tar.gz
,并解压
bash
$ tar -zxvf tengine-3.1.0.tar.gz
安装依赖,其中openssl
与openssl-devel
用于支持HTTPS,可不安装,不安装时编译时取消参数--with-http_ssl_module
bash
$ sudo yum install pcre pcre-devel openssl openssl-devel gcc make
编译安装Tengine
bash
$ cd tengine-3.1.0
$ ./configure --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-stream --with-http_upstream_check_module
$ make
$ sudo make install
2. 启动Tengine
bash
$ sudo /usr/local/nginx/sbin/nginx
配置文件
Tengine配置文件与Nginx一致,可直接使用Nginx配置文件
参考配置
nginx
...
server {
listen 80;
server_name 10.111.62.238;
#charset utf-8;
#access_log logs/host.access.log main;
#access_log "pipe:rollback logs/host.access_log interval=1d baknum=7 maxsize=2G" main;
location / {
root /www/html;
# 需要try_files配置Vue-Router才能生效
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
...