Get Started With IP2Proxy Apache Module

Dependencies

This module requires IP2Proxy BIN database to function. You may download the BIN database at


Requirements

  1. IP2Proxy C library.

  2. Apache 2.0x.

  3. GNU make or any compatible make utility.


Installation

You can install the IP2Proxy Apache Module in either Linux or Windows.

Linux

  1. Create a new folder called ip2location.

  2. Download IP2Proxy C library from here into the ip2proxy folder.

  3. Decompress C library.

    unzip master.zip
  4. Get into working directory.

    cd ip2proxy-c-master
  5. Start compilation.

    autoreconf -i -v --force
    ./configure
    make
    make install
  6. Download and decompress Apache module into the ip2proxy folder.

  7. Get into IP2Proxy Apache Module directory.

    cd ip2proxy-apache-master
  8. Start compilation.

    apxs2 -i -a -L /usr/local/lib/ -I ../ip2proxy-c-master/libIP2Proxy/ -l IP2Proxy -c mod_ip2proxy.c
    ln -s /usr/local/lib/libIP2Proxy.so.1 /usr/lib/libIP2Proxy.so.1
  9. Add following lines into /etc/apache2/apache2.conf.

    <IfModule mod_ip2proxy.c>
    	IP2ProxyEnable <On|Off>
    	# ENV will set server variables
    	# NOTES will set apache notes
    	# ALL will set both
    	IP2ProxySetmode <ALL|ENV|NOTES>
    	IP2ProxyDBFile <PATH_TO_IP2PROXY_BINARY_DATABASE>
    	IP2ProxyDetectProxy <On|Off>
    </IfModule>

Windows

  1. Create a new folder called ip2proxy.

  2. Download IP2Proxy C library from here into the ip2proxy folder.

  3. Decompress C library using 7-zip or other compression tools.

  4. Get into working directory.

    cd ip2proxy-c-master
  5. Start compilation.

    nmake /f Makefile.win
  6. Download and decompress Apache module into the ip2proxy folder.

  7. Navigate to ip2proxy-apache-master folder.

  8. Edit Makefile.win to change the path for C library.

    IP2PROXY_CSRC_PATH = C:/ip2proxy/ip2proxy-c-master/libIP2ProxyIP2PROXY_CLIB_PATH = C:/ip2proxy/ip2proxy-c-master/libIP2ProxyAPACHE_INSTALL_PATH = "C:/Program Files/Apache Software Foundation/Apachex.x"
  9. Start compilation.

    nmake /f Makefile.win
  10. Copy ip2proxy_apache.dll generated to the Apache modules directory.

  11. Add following lines into httpd.conf.

    <IfModule mod_ip2proxy.c>
    	IP2ProxyEnable <On|Off>
    	# ENV will set server variables
    	# NOTES will set apache notes
    	# ALL will set both
    	IP2ProxySetmode <ALL|ENV|NOTES>
    	IP2ProxyDBFile <PATH_TO_IP2PROXY_BINARY_DATABASE>
    	IP2ProxyDetectProxy <On|Off>
    </IfModule>

Sample Codes

Apache .htaccess
RewriteEngine On
RewriteCond %{ENV:IP2PROXY_IS_PROXY} ^Yes$
RewriteRule ^(.*)$ http://www.google.co.uk [L]
Apache Mod Security
SecRule ENV:IP2PROXY_IS_PROXY "Yes" "deny,status:500,id:5000888,msg:'Block visitor using proxy server'"

IP2Proxy Sample Database (BIN)

Sample Packages - BIN File IPv4 + IPv6
IP2Proxy PX1 Download (391.66 kB)
IP2Proxy PX2 Download (406.53 kB)
IP2Proxy PX3 Download (435.82 kB)
IP2Proxy PX4 Download (471.49 kB)
IP2Proxy PX5 Download (491.37 kB)
IP2Proxy PX6 Download (493.92 kB)
IP2Proxy PX7 Download (534.57 kB)
IP2Proxy PX8 Download (540.70 kB)
IP2Proxy PX9 Download (541.56 kB)
IP2Proxy PX10 Download (677.91 kB)
IP2Proxy PX11 Download (684.40 kB)
IP2Proxy PX12 Download (687.12 kB)

Articles & Tutorials