How to Add Yunsuo WAF Module to Tengine

Note: This article applies to systems that have previously installed Tengine but not the Yunsuo module.
Environment: CentOS, Yunsuo, Tengine

yum -y install jemalloc pcre* openssl*

Make a backup before installation:

cp /usr/local/nginx/sbin/nginx   /usr/local/nginx/sbin/nginx.bak

1. Download (you need to re-download the previous Tengine version):
Download Tengine:

#cd /usr/local/
#wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz
#tar zxvf tengine-2.1.2.tar.gz

Download Yunsuo module:

#wget https://codeload.github.com/yunsuo-open/nginx-plugin/zip/master -O nginx-plugin-master.zip
#unzip nginx-plugin-master.zip

2. Check which modules were previously loaded:

#nginx -V

The modules loaded on my local machine are roughly as follows:

–with-http_ssl_module –with-http_flv_module –with-http_stub_status_module –with-http_gzip_static_module –with-http_upstream_check_module

3. Installation and Configuration (Common Modules):

#cd tengine-2.1.2
#./configure –prefix=/usr/local/nginx –with-http_ssl_module –with-http_flv_module –with-http_stub_status_module –with-http_gzip_static_module –with-http_upstream_check_module  –add-module=/usr/local/nginx-plugin-master

That is, in addition to the standard Tengine installation steps, add: –add-module=/usr/local/nginx-plugin-master

# make

Note: Be sure not to execute `make install`, otherwise it will overwrite the previously configured nginx.conf.

rm -rf /usr/local/nginx/sbin/nginx
cp objs/nginx /usr/local/nginx/sbin/nginx
service nginx restart

4. Let Yunsuo recognize your self-compiled Tengine:

cd /usr/local/yunsuo_agent/nginx/
./configure_compile_nginx   /usr/local/nginx

Leave a Comment

Your email address will not be published.