允许使用 CURL:
ip.threep.top
ifconfig. io
ip.fm
cip.cc
myip.ipip.net
ip.sb
ifconfig.me
checkip.dyndns.com
api.myip.com
其他
ip.coderbusy.com
使用示例(Shell脚本):
<span class="token important">#!/bin/sh</span>
ip<span class="token operator">=</span>$<span class="token punctuation">(</span>curl <span class="token operator">-</span>s https<span class="token punctuation">:</span><span class="token operator">/</span><span class="token operator">/</span>api<span class="token punctuation">.</span>ip<span class="token punctuation">.</span>sb<span class="token operator">/</span>ip<span class="token punctuation">)</span>
<span class="token keyword">echo</span> <span class="token string">"My IP address is: <span class="token property">$ip</span>"</span>
nginx直接返回服务者IP配置:
location / {
default_type text/plain;
return 200 "$remote_addr\n" ;
}//如果显示的IP不正确,可能使用了防火墙cdn之类的,可以试试 把$remote_addr改成$http_x_forwarded_for