如题所示,这个模块可以打印输出一些东西,一般用于调试nginx的参数时使用。安装步骤如下:

[root@tkde-iphone src]# wget https://github.com/openresty/echo-nginx-module/archive/v0.59.tar.gz

[root@tkde-iphone src]# tar -zxvf v0.59.tar.gz

[root@tkde-iphone nginx-1.4.7]# ./configure –prefix=/usr/local/nginx –user=www –group=www –with-http_stub_status_module –with-openssl=/usr/include/openssl –with-pcre=/usr/local/src/pcre-8.36 –add-module=/usr/local/src/ngx_cache_purge-2.0 –with-http_gzip_static_module –add-module=/usr/local/src/nginx_upstream_hash-0.3.1 –add-module=/usr/local/src/echo-nginx-module-0.59

[root@tkde-iphone nginx-1.4.7]# make && make install


测试:

server {
         ...
    location /nginx-test {
                echo $clientRealIp;
         }

...
}


浏览器中访问:http://192.168.1.30/nginx-test

输出如下:

192.168.1.78

注:这里的$clientRealIp是在这篇文章中提及到的:https://www.zifangsky.cn/659.html