Nginx 安装 echo-nginx-module 模块


Nginx-echo 模块可以在 Nginx 中用来输出一些信息,是在测试排错过程中一个比较好的工具!

1、下载压缩包:

wget https://github.com/openresty/echo-nginx-module/archive/v0.61.tar.gz

2、解压:

tar zxf v0.61.tar.gz

3、进入 nginx 目录,重新编译安装:

./configure --add-module=../echo-nginx-module
make && make install

4、安装完成后,查看当前 Nginx 详细信息:

[root@Centos nginx]# ./sbin/nginx -V
nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) 
configure arguments: --prefix=/usr/local/nginx --add-module=/opt/echo-nginx-module-0.61
[root@Centos nginx]# 

5、重启 Nginx,使模块生效:

[root@Centos nginx]# ./sbin/nginx -s reload

6、测试:

(1)在 nginx.conf 添加一个 location:

location /test {
    echo "hello world"
}

(2)使用 curl 访问测试:

[root@Centos conf]# curl http://localhost:8000/test
hello world
[root@Centos conf]# 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM