如题所示,这个模块可以打印输出一些东西,一般用于调试nginx的参数时使用。安装步骤如下:
1
2
3
|
[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
测试:
1
2
3
4
5
6
7
8
|
server {
...
location /nginx-test {
echo $clientRealIp;
}
...
}
|
浏览器中访问:http://192.168.1.30/nginx-test
输出如下:
1
|
192.168.1.78
|
本文转自 pangfc 51CTO博客,原文链接:http://blog.51cto.com/983836259/1862895,如需转载请自行联系原作者