Public IP Address

You can always use your own nginx instead of using 3rd party services when you need to know your public IP.

Like this:

# Public IP
location = /ip {
    default_type text/plain;
    return 200 $remote_addr;
}

Or if you need it in JSON format like this:

# Public IP JSON
location = /ip_json {
    default_type application/json;
    return 200 "{\"ip\":\"$remote_addr\"}";
}