Centos编译安装Tengine

1. 安装相关依赖

yum install gcc gcc-c++ opensslopenssl-devel  zib-devel zib

2. 进入 /usr/local 目录

3. 编译pcre

wget https://sourceforge.net/projects/pcre/files/pcre/8.38/pcre-8.38.tar.gz

tar xzvf pcre-8.38.tar.gz

cd pcre-8.38

./configure && make -j4 && make install

4.编译Tegine

① Tegine报错:./configure: error: SSL modules require the OpenSSL library.

yum -y install openssl openssl-devel

② 编译

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

tar xzvf tengine-2.3.3.tar.gz

cd tengine-2.3.3

./configure && make && make install

5. 使用

在/usr/local/nginx目录下使用即可

cd /usr/local/nginx

/sbin/nginx -t # 测试配置
/sbin/nginx # 启动
/sbin/nginx -s reload # 重启
/sbin/nginx -s stop # 停止

6. 相关问题

① 报错nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

将配置文件挂载就行 /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

② 配置http2

cd /usr/local/tengine-2.3.3
./configure --with-http_v2_module
make
make install

③ 发现一个坑,在配ssl时,会报缺少模块的错nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in ...

可以在配置的时候加上--with-http_ssl_module
比如./configure --prefix=/usr/local/nginx --with-http_ssl_module
具体参考https://www.cnblogs.com/ghjbk/p/6744131.html

④ 添加到开机自启

编辑/etc/rc.d/rc.local文件, 在下面加一行

/usr/local/nginx/sbin/nginx
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容