Excuse the language, but it's a lamentation I've uttered many times while navigating to whatismyip.com and being bombarded with ads and superfluous text when all I want is at most 15 characters. It's also in reference to sites like the fucking weather and what the fuck should I make for dinner which are hilarious in their vulgarity. Unfortunately, whatismyfuckingipaddress.com was already taken.
I decided I was going to create a "competitor" to whatismyip.com because that site sucks. But mostly because it's something so simple that it shouldn't require navigating a bunch of text and ads. Of course, as it turns out, numerous sites already do that (like http://icanhazip.com/), and whatismyip.com offers a similar service here.
But just because someone else has already done something many times doesn't mean you shouldn't do it, too. Right?
But I didn’t want to bootstrap some server-side language runtime for something as simple as displaying an IP address. Surely that could be done directly from the server. And it can.
server {
listen 80;
server_name remoteaddr.info www.remoteaddr.info;
gzip off;
location = / {
default_type text/plain;
echo $remote_addr;
if ($remote_addr != $proxy_add_x_forwarded_for) {
echo $proxy_add_x_forwarded_for;
}
expires 1d;
}
location = /about {
default_type text/html;
echo "<html>";
echo "<head>";
echo "<title>about remoteaddr.info</title>";
echo "</head>";
echo "<body>";
echo '<pre>created by <a href="http://tommymontgomery.com/">Tommy Montgomery</a> using the <a href="http://wiki.nginx.org/HttpEchoModule">nginx echo module</a>.</pre>';
echo "</body>";
echo "</html>";
}
location = /robots.txt {
default_type text/plain;
echo "User-Agent: *";
echo "Allow: /about";
echo "Disallow: /";
}
}