tengine
赵志龙:
./nginx -s stop
赵志龙:
./nginx -t
赵志龙:
requirepass 1234
CentOS 7上源码安装Tengine-2.3.2
![CentOS 7上源码安装Tengine-2.3.2](https://www.bootschool.net/upload/2019/10/28qj03qbbmh9dpm0lbkatfvmao.jpg)
编译工具&依赖库安装
[root@localhost ~]# yum install gcc-c++
[root@localhost ~]# yum install pcre
[root@localhost ~]# yum install pcre-devel
[root@localhost ~]# yum install pcre
[root@localhost ~]# yum install zlib
[root@localhost ~]# yum install zlib-devel
[root@localhost ~]# yum install openssl
[root@localhost ~]# yum install openssl-devel
Tengine 下载&解压安装
[root@localhost ~]# wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
[root@localhost ~]# tar -zxvf tengine-2.3.2.tar.gz
[root@localhost ~]# cd tengine-2.3.2
Tengine 编译&安装
[root@localhost tengine-2.3.2]# ./configure
[root@localhost tengine-2.3.2]# make
[root@localhost tengine-2.3.2]# sudo make install
说明:默认情况下,tengine会被安装到
/usr/local/nginx
目录下
Tengine 目录说明
[root@localhost tengine-2.3.2]# cd /usr/local/nginx
[root@localhost nginx]# tree -d
.
├── conf //配置文件目录
├── html //静态网页文件目录
├── logs //日志文件目录
└── sbin //可执行文件目录
Tengine 启动&测试
[root@localhost tengine-2.3.2]# cd /usr/local/nginx/sbin
[root@localhost sbin]# ./nginx
然后使用浏览器访问测试
http://192.168.100.100
如果看到如下页面,说明安装成功
Tengine 安装常见错误
1、如果出现如下错误提示,说明系统中没有安装gcc编译工具,我们只需要安装gcc-c++
即可,
[root@localhost tengine-2.3.2]# ./configure
checking for OS
+ Linux 3.10.0-957.27.2.el7.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found
解决办法:
[root@localhost tengine-2.3.2]# yum install gcc-c++
2、如果出现如下提示,表示缺少PCRE库:
[root@localhost tengine-2.3.2]# ./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.
解决办法:
[root@localhost tengine-2.3.2]# yum install pcre
[root@localhost tengine-2.3.2]# yum install pcre-devel
3、如果出现如下提示,表示缺少zlib库:
[root@localhost tengine-2.3.2]# ./configure
./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.
解决办法:
[root@localhost tengine-2.3.2]# yum install zlib
[root@localhost tengine-2.3.2]# yum install zlib-devel
THE END
http {
include mime.types;
default_type application/octet-stream;
#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;
#access_log "pipe:rollback logs/access_log interval=1d baknum=7 maxsize=2G" main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
upstream tomcat_web {
server localhost:8080 weight=1 max_fails=2 fail_timeout=30s;
server localhost:81 weight=1 max_fails=2 fail_timeout=30s;
}
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#access_log "pipe:rollback logs/host.access_log interval=1d baknum=7 maxsize=2G" main;
location / {
proxy_pass http://tomcat_web;
}
#error_page 404 /404.html;
# redirect server error pages to the static page