ip.zuim.de/README.md

4.2 KiB

ip.zuim.de

Shows information on connectivity of a user, by testing both IPv4 and IPv6. Also shows geoip data.

Warning:

This code is mostly unmaintained and uses several old javascript libraries.

Setup:

The following domain setup is required, for the IPv4/IPv6 tests to work:

  • The domains can be changed in include/config.php
  • A record for v4.ip.zuim.de and no AAAA record, so only IPv4 is possible for this domain
  • AAAA record for v6.ip.zuim.de and no A record, so only IPv6 is possible for this domain
  • A and AAAA record for ip.zuim.de as the main entry point
  • Set up your webserver, so direct ip access and all of these domains resolve to the project directory.

To get the geoip data, the geoip2 module for nginx is used with the following configuration:

geoip2 /var/lib/GeoIP/GeoLite2-City.mmdb {
	auto_reload 1h;
	$geoip2_data_continent_code continent code;
	$geoip2_data_continent_name continent names en;
	$geoip2_data_country_code country iso_code;
	$geoip2_data_country_name country names en;
	$geoip2_data_subdivision subdivisions 0 names en;
	$geoip2_data_city_name city names en;
	$geoip2_data_postal_code postal code;
	$geoip2_data_location_time location time_zone;
}

geoip2 /var/lib/GeoIP/GeoLite2-ASN.mmdb {
	auto_reload 1h;
	$geoip2_data_asn autonomous_system_organization;
}

Then the following should be used, to pass this data to php:

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  REQUEST_SCHEME     $scheme;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  REMOTE_USER        $remote_user;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

#for proxy detection
fastcgi_param HTTP_X_FORWARDED_FOR $http_x_forwarded_for;

#pass all geoip data
fastcgi_param GEOIP_CONTINENT_CODE $geoip2_data_continent_code;
fastcgi_param GEOIP_CONTINENT_NAME $geoip2_data_continent_name;
fastcgi_param GEOIP_COUNTRY_CODE $geoip2_data_country_code;
fastcgi_param GEOIP_COUNTRY_NAME $geoip2_data_country_name;
fastcgi_param GEOIP_SUBDIVISION $geoip2_data_subdivision;
fastcgi_param GEOIP_CITY_NAME    $geoip2_data_city_name;
fastcgi_param GEOIP_POSTAL_CODE    $geoip2_data_postal_code;
fastcgi_param GEOIP_LATITUDE    $geoip2_data_location_lat;
fastcgi_param GEOIP_LONGITUDE    $geoip2_data_location_long;
fastcgi_param GEOIP_ACCURACY    $geoip2_data_location_acc;
fastcgi_param GEOIP_TIMEZONE    $geoip2_data_location_time;
fastcgi_param GEOIP_ASN    $geoip2_data_asn;

The following is the nginx config for the server block:

server
{
        listen 80;
        listen [::]:80;
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        
        server_name v4.ip.zuim.de v6.ip.zuim.de ip.zuim.de 89.58.44.51 [2a03:4000:67:e03::1];
        
        root PROJEKTORDNER

        location  /speedtest
        {
                proxy_pass http://unix:/run/nodejs/speedtest/socket;
                proxy_http_version 1.1;
                #include include/proxy_params;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
        }
       
        include include/php;
        include include/ssl_zuim;
}

Download these files directly and add them in the main folder: