Does Directadmin have mod_geoip2 installed?- GeoIP htaccess

janton

Verified User
Joined
Sep 17, 2009
Messages
145
Hey All,

I was hoping somebody could push me in the right direction.
I would like to use GeoIP in my htaccess file. I'm note sure if Directadmin has this mod_geoip2 already installed with costum apache2. Also i was wondering how to do this for directadmin, are there different steps then normal?

I just downloaded the http://geolite.maxmind.com/download/geoip/api/mod_geoip2/
And i readed the install document and the Readme document.
But because i'm afraid i will break something from my apache i will ask here how to continue:
install document says.
apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c

is this also the right way for directadmin apache, i have comstumbuild apache


===========================================================================
To build mod_geoip as a dynamically loadable module:

apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c


-I/usr/local/include is where the GeoIP.h header file is installed
-L/usr/local/lib is where the libGeoIP library is located

This will put the correct LoadModule statement.

You will need to add:

===========================================================================
Configuration

To enable the module, place

<IfModule mod_geoip.c>
GeoIPEnable On
</IfModule>

inside your httpd.conf file. ( You don't have to have the <IfModule> block,
but it's always a good idea.

( You can optionally specify the data file by using:

<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/tmp/GeoIP.dat
</IfModule>

)

See the README file for more details on the configuration

===========================================================================





Also i'm not sure where to put the GeoIP.dat file. I read default location (e.g. /usr/local/share/GeoIP/GeoIP.dat) >Should i create this directory GeoIP and place it there?
Or can i place it also under /home/username/domains/site.com/GeoIP/GeoIP.dat

Do i need to download the new GeoIP.dat every month? and replace it by hand?
 
I also read on a different site i first have to do this:

cd /usr/src
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.7.tar.gz
tar -xvzf GeoIP*
cd GeoIP*
./configure
make
make install

and then:

cd /usr/src
wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.5.tar.gz
tar -xvzf mod_geoip*
cd mod_geoip*
/usr/local/apache/bin/apxs -i -a -L/usr/src/GeoIP-1.4.6/libGeoIP -I/usr/src/GeoIP-1.4.6/lib/GeoIP -lGeoIP -c mod_geoip.c

Please note, you need to enable mod_geoip inside your httpd.conf with the following lines:

GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat
 
You can tell if a module is installed:
Code:
httpd -l
will give you a list of installed modules.

I believe you should be able to follow those instructions to install the module on your server; and then make the change to enable it in Apache. But I've not tested it.

Jeff
 
I did everything like above but it seems something is still not correct a get this error when i restart httpd with :
LoadModule geoip_module /usr/lib/apache/mod_geoip.so

error:

Starting httpd: httpd: Syntax error on line 22 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib/apache/mod_geoip.so into server: libGeoIP.so.1: cannot open shared object file: No such file or directory



i did the following:
cd /usr/src
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.7.tar.gz
tar -xvzf GeoIP*
cd GeoIP*
./configure
make
make install

and then:

cd /usr/src
wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.5.tar.gz
tar -xvzf mod_geoip*
cd mod_geoip*
apxs -i -a -L/usr/src/GeoIP-1.4.7/libGeoIP -I/usr/src/GeoIP-1.4.7/lib/GeoIP -lGeoIP -c mod_geoip.c
 
ok thx i found the file:

/usr/local/lib/libGeoIP.so.1
with some other libGeoIP files

very strainge the file or perhaps files are not found by default.. because i did everything like they told in the install document. I'm not sure how to add this directory to httpd.conf, but i'm more curious where it looks now> Where does it think is...

Ok i will try to do more research but any help is welcome!
 
What do you mean? Because this is the right direction of mod_geoip.so

LoadModule geoip_module /usr/lib/apache/mod_geoip.so

i already tried duplicating mod_geoip.so to /usr/local/lib/mod_geoip.so and changed the httpd.conf file to that direction, but i got the same kind of error but than with a different location of mod_geoip.so ofcourse.


Starting httpd: httpd: Syntax error on line 22 of /etc/httpd/conf/httpd.conf: Cannot load /usr/local/lib/mod_geoip.so into server: libGeoIP.so.1: cannot open shared object file: No such file or directory
 
but the file name got uppercase.

/usr/local/lib/libGeoIP.so.1

be sure to point to correct directory with the .so file and keep the uppercase letter.

Regards
 
I linked to the wrong library! Compile mod_geoip with this line and it workes!.

apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c
 
I am getting the same error as janton got, but I don't know how to recompile this stuff.
Tried to install as described in comment #2, after that I tried:

Code:
cd /usr/src/mod_geoip2_1.2.5

apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c
service httpd restart

But the I get the same error message:
Code:
Syntax error on line 18 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib/apache/mod_geoip.so into server: libGeoIP.so.1: cannot open shared object file: No such file or directory

mod_geoip.so is still sitting in /usr/lib/apache/ doing nothing. :rolleyes:
How can I recompile mod_geoip in the right way?
 
I guess I had to find out myself. For anyone else in need of Geoip:

Search for GeoIP.dat
Code:
find / -name 'GeoIP.dat'

Found out that mine is at: /usr/local/share/GeoIP/GeoIP.dat

Edit httpd:

Code:
vi /etc/httpd/conf/httpd.conf

And add this:


Code:
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat
</IfModule>
 
This is where I am stuck as well. However, adding the following to my httpd.conf file didn't do anything. No errors, Apache started fine. So at this point I am stuck.. any help would be greatly appreciated.

Code:
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat
</IfModule>
 
Back
Top