Binding Postfix to particular IP addresses

I had a problem where my postfix mail system wasn’t listening on its IP address 10.1.1.123 but it was listening on 127.0.0.1. I checked my firewall settings and made sure port 25 was open, but I still couldn’t connect.

I read an article, Bind Postfix Mail Server To Localhost or Specific IP Address Only, which gave me the hint I needed.

The trick was to comment out inet_interfaces in /etc/postfix/main.cf because it was specifying loopback-only which meant postfix wasn’t listening on its other IP addresses.

Adding an app/page to a Facebook Page

I found this article which said to add a page/app to a Facebook Page you need to hit this URL with your two parameters:


https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID &display=popup&next=YOUR_URL

Update: I was trying to add an ‘app’ rather than a ‘page tab’ and it turned out I needed this:


https://www.facebook.com/add.php?api_key=YOUR_APP_ID&pages 

GeoIP with MaxMind’s GeoLite in PHP

You can download the GeoLite Country database from GeoLite Free Downloadable Databases and you can grab the MaxMind GeoIP PHP API.

Once you have the GeoIP.dat file and the geoip.inc PHP file you’re good to go. E.g.:


  require_once __DIR__ . '/geoip/geoip.inc';

  $gi = geoip_open( __DIR__ . '/geoip/GeoIP.dat", GEOIP_STANDARD );

  $country_code = geoip_country_code_by_addr( $gi, $host );
  $country_name = geoip_country_name_by_addr( $gi, $host );

  geoip_close( $gi );