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]# 

 

相关文章:

  • 2021-09-28
  • 2021-07-27
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
  • 2021-12-24
  • 2022-01-30
  • 2021-11-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
相关资源
相似解决方案