显示客户端IP的详细信息
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

80 lines
2.2 KiB

server {
listen 80;
listen [::]:80;
server_name ip.343.re; # 改为自己的域名
location / {
if ($http_user_agent !~* (curl|wget)) {
return 301 https://$server_name$request_uri;
}
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:1601;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ip.343.re; # 改为自己的域名
ssl_certificate /etc/ssl/certs/343.re/fullchain.pem; # 改为自己的证书
ssl_certificate_key /etc/ssl/certs/343.re/privkey.pem;
gzip on;
gzip_buffers 32 4K;
gzip_comp_level 6;
gzip_min_length 100;
gzip_types application/javascript text/css text/xml;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:1601;
}
}
server {
listen 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;
}
default_type application/json;
return 200 $http_user_agent;
}
location = / {
proxy_set_header X-Real-IP $remote_addr;
if ($http_user_agent ~* (curl|wget)) {
proxy_pass http://$my_host/query?justip=true&cli=true;
}
index index.html;
}
location / {
set $query_param $query_string;
if ($http_user_agent ~* (curl|wget)) {
set $query_param $query_param&cli=true;
}
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000; # 服务器php-fpm接口
fastcgi_param QUERY_STRING $query_param;
fastcgi_param SCRIPT_FILENAME /var/www/echoIP/backend/queryInfo.php;
}
}