diff --git a/Dockerfile b/Dockerfile index 18bb9eb..cfb6f7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ FROM alpine +LABEL version="1.1" \ + maintainer="dnomd343" \ + description="echo client IP details" COPY . /var/www/echoIP ADD ./conf/docker/init.sh / RUN apk --update add --no-cache nginx curl nodejs php7 php7-fpm php7-json php7-iconv php7-sqlite3 php7-openssl && \ @@ -6,4 +9,5 @@ RUN apk --update add --no-cache nginx curl nodejs php7 php7-fpm php7-json php7-i cp /var/www/echoIP/conf/nginx/docker.conf /etc/nginx/conf.d && \ cp /var/www/echoIP/conf/docker/init.sh / && \ sed -i '$i\0\t0\t*\t*\t*\t/var/www/echoIP/backend/qqwryUpdate.sh' /var/spool/cron/crontabs/root +EXPOSE 1601 CMD ["sh","init.sh"] diff --git a/README.md b/README.md index 9dcfb61..e1c140f 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ shell> curl ip.343.re/8.8.8.8 ### 网页访问模式 -你可以直接在 [ip.343.re](https://ip.343.re/) 进行查询,或者将项目部署到自己的服务器上。 +你可以直接在 [https://ip.343.re](https://ip.343.re) 或 [https://ip.dnomd343.top](https://ip.dnomd343.top) 上进行查询,或者将项目部署到自己的服务器上。 ![echoIP-web](https://pic.dnomd343.top/images/Wg7.png) @@ -40,9 +40,9 @@ shell> curl ip.343.re/8.8.8.8 > 如果想在自己域名下建立本服务,可按如下方式部署 -### Docker方式 +### Docker方式(推荐) -echoIP支持Docker容器部署,在[Docker Hub](https://hub.docker.com/repository/docker/dnomd343/echoip)或[Github Package](https://github.com/dnomd343?tab=packages&repo_name=echoIP)有打包完成的镜像下载。 +echoIP支持Docker容器部署,在[Docker Hub](https://hub.docker.com/repository/docker/dnomd343/echoip)可获取已构建的镜像。 确定你的服务器上有Docker环境 @@ -55,7 +55,7 @@ shell> docker -v ``` # 映射容器服务到宿主机1601端口 -shell> docker run -dit --name echoip -p 1601:8080 dnomd343/echoip +shell> docker run -d --name echoip -p 1601:1601 dnomd343/echoip ``` 测试容器是否正常工作 @@ -211,7 +211,7 @@ shell> docker build -t echoip https://github.com/dnomd343/echoIP.git#master 启动容器 ``` -shell> docker run -dit --name echoip -p 1601:8080 echoip +shell> docker run -d --name echoip -p 1601:1601 echoip ``` 进入容器调试 @@ -251,8 +251,10 @@ ip -> 请求指定IP的数据 ``` shell> curl "ip.343.re/query?justip=true" {"ip":"116.57.98.121"} + shell> curl "ip.343.re/query?justip=true&cli=true" 116.57.98.124 + shell> curl "ip.343.re/query?cli=true&ip=7.7.7.7" IP: 7.7.7.7 AS: AS8003 diff --git a/backend/queryInfo.php b/backend/queryInfo.php index b36026a..4921daa 100644 --- a/backend/queryInfo.php +++ b/backend/queryInfo.php @@ -222,7 +222,7 @@ function routeParam() { } else { $reply = array(); $reply['status'] = 'F'; - $reply['message'] = 'Illegal IP format'; + $reply['message'] = 'Illegal Request'; header('Content-Type: application/json; charset=utf-8'); echo json_encode($reply); } diff --git a/conf/docker/init.sh b/conf/docker/init.sh index 8a25ef2..99ce53f 100644 --- a/conf/docker/init.sh +++ b/conf/docker/init.sh @@ -2,4 +2,3 @@ /usr/sbin/nginx /usr/sbin/crond node /var/www/echoIP/backend/qqwryFormat/server.js -/bin/sh diff --git a/conf/nginx/docker.conf b/conf/nginx/docker.conf index c66e980..69ec84f 100644 --- a/conf/nginx/docker.conf +++ b/conf/nginx/docker.conf @@ -1,6 +1,6 @@ server { - listen 8080; - set $this 127.0.0.1:8080; + listen 1601; + set $this 127.0.0.1:1601; set_real_ip_from 0.0.0.0/0; real_ip_header X-Real-IP; @@ -70,4 +70,4 @@ server { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /var/www/echoIP/backend/queryInfo.php; } -} \ No newline at end of file +}