Get Started With IP2Proxy Apache Module
Dependencies
This module requires IP2Proxy BIN database to function. You may download the BIN database at
IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
IP2Proxy Commercial BIN Data (Comprehensive): https://www.ip2location.com
Requirements
Apache 2.0x.
GNU make or any compatible make utility.
Installation
You can install the IP2Proxy Apache Module in either Linux or Windows.
Linux
Create a new folder called ip2location.
Download IP2Proxy C library from here into the ip2proxy folder.
-
Decompress C library.
unzip master.zip
-
Get into working directory.
cd ip2proxy-c-master
-
Start compilation.
autoreconf -i -v --force ./configure make make install
-
Download and decompress Apache module into the ip2proxy folder.
-
Get into IP2Proxy Apache Module directory.
cd ip2proxy-apache-master
-
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
-
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
Create a new folder called ip2proxy.
Download IP2Proxy C library from here into the ip2proxy folder.
Decompress C library using 7-zip or other compression tools.
-
Get into working directory.
cd ip2proxy-c-master
-
Start compilation.
nmake /f Makefile.win
-
Download and decompress Apache module into the ip2proxy folder.
-
Navigate to ip2proxy-apache-master folder.
-
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"
-
Start compilation.
nmake /f Makefile.win
-
Copy ip2proxy_apache.dll generated to the Apache modules directory.
-
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) |