具体方法:

(推荐教程:nginx教程)

查看nginx目前模块

/usr/local/nginx/sbin/nginx -V

如:

nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) 
configure arguments: --add-module=/usr/local/fast/fastdfs-nginx-module/src/

添加模块 stream

cd /usr/local/nginx-1.12.2
#需要把之前的参数带上
./configure --add-module=/usr/local/fast/fastdfs-nginx-module/src/ --with-stream
make (切忌不要输入make install,否则会覆盖掉nginx文件)

停止nginx

ps -ef | grep nginx|grep -v grep|cut -c 9-15|xargs kill -9

cp nginx文件

cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
cp /usr/local/nginx-1.12.2/objs/nginx /usr/local/nginx/sbin/

启动nginx

 /usr/local/nginx/sbin/nginx

查看依赖模块

/usr/local/nginx/sbin/nginx -V