Example of using the echo module in nginx

Source: Internet
Author: User
Tags curl

I am using nginx in ubuntu,

View nginx version, nginx-V

Nginx version: nginx/1.1.19

Ensure that the nginx-echo module is available

-Add-module =/build/buildd/nginx-1.1.19/debian/modules/nginx-echo

Next, add the configuration in ip.jpuyy.com to return the client ip address, and add the return client ip address in the http header.

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;
        }

}
Get your own IP address

Region ~ Curl ip.jpuyy.com

183.195.128.xx

Region ~ 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

Or

Curl-I ip.jpuyy.com | grep X-Client | sed's // '| cut-d:-f2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.