|
|
@ -34,13 +34,21 @@ server { |
|
|
|
|
|
|
|
server { |
|
|
|
listen 127.0.0.1:1601; |
|
|
|
set $this 127.0.0.1:1601; |
|
|
|
set $my_host 127.0.0.1:1601; |
|
|
|
set_real_ip_from 0.0.0.0/0; |
|
|
|
real_ip_header X-Real-IP; |
|
|
|
|
|
|
|
root /var/www/echoIP; |
|
|
|
error_page 403 404 = /error.html; |
|
|
|
|
|
|
|
location ^~ /assets {} |
|
|
|
location = /index.html {} |
|
|
|
location = /error.html {} |
|
|
|
|
|
|
|
location = /error { |
|
|
|
index error.html; |
|
|
|
} |
|
|
|
|
|
|
|
location = /ua { |
|
|
|
if ($http_user_agent ~* (curl|wget)) { |
|
|
|
return 200 $http_user_agent\n; |
|
|
@ -52,56 +60,19 @@ server { |
|
|
|
location = / { |
|
|
|
set $query_param ?justip=true&cli=true; |
|
|
|
if ($http_user_agent ~* (curl|wget)) { |
|
|
|
proxy_pass http://$this/query$query_param; |
|
|
|
proxy_pass http://$my_host/query$query_param; |
|
|
|
} |
|
|
|
index index.html; |
|
|
|
} |
|
|
|
|
|
|
|
location = /ip { |
|
|
|
set $query_param ?justip=true; |
|
|
|
if ($http_user_agent ~* (curl|wget)) { |
|
|
|
set $query_param $query_param&cli=true; |
|
|
|
} |
|
|
|
proxy_pass http://$this/query$query_param; |
|
|
|
} |
|
|
|
|
|
|
|
location = /version { |
|
|
|
set $query_param ?version=true; |
|
|
|
location / { |
|
|
|
set $query_param $query_string; |
|
|
|
if ($http_user_agent ~* (curl|wget)) { |
|
|
|
set $query_param $query_param&cli=true; |
|
|
|
} |
|
|
|
proxy_pass http://$this/query$query_param; |
|
|
|
} |
|
|
|
|
|
|
|
location ~* ^/([^/]+?)$ { |
|
|
|
set $request_ip $1; |
|
|
|
if ($http_user_agent ~* (curl|wget)) { |
|
|
|
proxy_pass http://$this/info/$request_ip; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
location ^~ /info { |
|
|
|
set $is_legal 0; |
|
|
|
set $query_param ?cli=false; |
|
|
|
if ($http_user_agent ~* (curl|wget)) { |
|
|
|
set $query_param ?cli=true; |
|
|
|
} |
|
|
|
if ($uri ~* ^/info/?$) { |
|
|
|
set $is_legal 1; |
|
|
|
} |
|
|
|
if ($uri ~* ^/info/([^/]+?)$) { |
|
|
|
set $is_legal 1; |
|
|
|
set $query_param $query_param&ip=$1; |
|
|
|
} |
|
|
|
if ($is_legal = 0) { |
|
|
|
set $query_param $query_param&error=true; |
|
|
|
} |
|
|
|
proxy_pass http://$this/query$query_param; |
|
|
|
} |
|
|
|
|
|
|
|
location = /query { |
|
|
|
include fastcgi_params; |
|
|
|
fastcgi_pass 127.0.0.1:9000; |
|
|
|
fastcgi_param QUERY_STRING $query_param; |
|
|
|
fastcgi_param SCRIPT_FILENAME /var/www/echoIP/backend/queryInfo.php; |
|
|
|
} |
|
|
|
} |