最新下载
热门教程
- 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
相关文章
- dreamweaver网页上怎么制作DI5图层? 07-13
- 村上春树经典语录大全81句 07-13
- 燕云十六声真假卧佛任务怎么完成-真假卧佛任务攻略 07-13
- ps怎么处理高低肩? ps照片人物高低肩的调整办法 07-13
- LoginPress PRO v5.0.1 汉化版 自定义WordPress 注册与登录 07-13
- Win11如何关闭安全中心?Win11关闭安全中心的方法 07-13