最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
nginx中 echo模块使用例子
时间:2022-06-30 18:40:43 编辑:袖梨 来源:一聚教程网
我这里在ubuntu下使用nginx,
查看nginx版本,nginx -V
nginx version: nginx/1.1.19
确保有nginx-echo模块
–add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-echo
接下来在ip.jpuyy.com中添加配置,返回客户端ip,同时在http头中也加返回客户端ip
server {
listen 80;
server_name ip.jpuyy.com;
location / {
root /usr/share/nginx/jpuyy.com;
index ip.html;
add_header X-Client-IP $remote_addr;
echo $remote_addr;
}
}
获取自己的ip地址
➜ ~ curl ip.jpuyy.com
183.195.128.xx
➜ ~ curl -I ip.jpuyy.com
HTTP/1.1 200 OK
Server: nginx/1.1.19
Date: Sat, 23 Aug 2014 05:24:03 GMT
Content-Type: application/octet-stream
Connection: keep-alive
X-Client-IP: 183.195.128.xx
或
curl -I ip.jpuyy.com | grep X-Client |sed ‘s/ //’ | cut -d: -f2
相关文章
- 《弓箭传说2》新手玩法介绍 01-16
- 《地下城与勇士:起源》断桥烟雨多买多送活动内容一览 01-16
- 《差不多高手》醉拳龙技能特点分享 01-16
- 《鬼谷八荒》毕方尾羽解除限制道具推荐 01-16
- 《地下城与勇士:起源》阿拉德首次迎新春活动内容一览 01-16
- 《差不多高手》情圣技能特点分享 01-16