ip_location_api
ip_location_api copied to clipboard
ip地址归属地查询api
ip地址归属地查询api
用法
-
安装nodejs
-
安装pm2守护进程模块
$ sudo npm install pm2 -g
-
下载本仓库
$ git clone https://github.com/elsonwx/ip_location_api.git
-
安装依赖
$ cd ip_location_api && npm install
-
修改api启动后监听的端口号(别忘了在机器的防火墙规则上允许此端口号)
修改
pm2_start_config.json
中的PORT
即可,默认为3001 -
启动api
$ pm2 start pm2_start_config.json
-
测试访问
-
ip138
http://api.elsonwx.com:3001/ip138/me
http://api.elsonwx.com:3001/ip138/1.2.3.4
-
ipipnet
http://api.elsonwx.com:3001/ipipnet/me
http://api.elsonwx.com:3001/ipipnet/1.2.3.4
把
api.elsonwx.com
换成你的ip或域名
,把3001
换成你设置的监听端口
,把1.2.3.4
换成你要查询的ip地址
-
更新
http://api.elsonwx.com:3001/ipipnet/lab/1.2.3.4