Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Internal Server Error 500 + mod_GeoIP Custom Module after install with EasyApache

Discussion in 'EasyApache' started by jameshurrell, Feb 17, 2011.

  1. jameshurrell

    jameshurrell Member

    Joined:
    Feb 17, 2011
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    53
    Hello,

    I have cPanel and WHM on CENTOS and need to use the Maxmind GeoIP tool to redirect incoming users based on their IP address.

    I found that cPanel offer a Custom Module and so I used these instructions to download and install mod_GeoIP and then rebuild Apache with the mod_GeoIP module included:

    Installing Free mod_GeoIP for Apache 2.x / Cpanel / CentOS | GNU Tool Box

    This went well, managed to download and install the module using Putty, then recompiled Apache using EasyApache. All seemed fine.

    I then downloaded the "lite" Country database from:

    Index of /download/geoip/database/GeoLiteCountry

    I placed it in /usr/local/share/GeoIP.dat (which is apparently the default location).

    However, now when I use "GeoIPEnable On" in my .htaccess file, I get an "Internal Server Error 500". If I add the same line to the "pre_virtualhost_global.conf" file, and then try to restart Apache, the restart fails.

    Edit: Using a phpinfo() file, I can see that the module is not listed - this is obviously the cause of the issue... so how do i go about enabling it?

    Does anyone know what I am doing wrong?

    Many thanks.
     
    #1 jameshurrell, Feb 17, 2011
    Last edited: Feb 17, 2011
  2. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    5
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Hello,

    Please execute the command httpd -l and check whether the module is enabled.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. jameshurrell

    jameshurrell Member

    Joined:
    Feb 17, 2011
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    53
    Thanks for your reply... forgive me, but where do I need to execute that command from? An SSH session?
     
  4. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    5
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Hello,

    Yea, please ssh into the server and execute httpd -l. If the module is enabled it will be in the list. Do let us know if you saw it there or not.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. jameshurrell

    jameshurrell Member

    Joined:
    Feb 17, 2011
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    53
    Many thanks again. It appears it is not listed:

    Code:
    core.c
      mod_authn_file.c
      mod_authn_default.c
      mod_authz_host.c
      mod_authz_groupfile.c
      mod_authz_user.c
      mod_authz_default.c
      mod_auth_basic.c
      mod_include.c
      mod_filter.c
      mod_log_config.c
      mod_logio.c
      mod_env.c
      mod_expires.c
      mod_headers.c
      mod_unique_id.c
      mod_setenvif.c
      mod_version.c
      mod_proxy.c
      mod_proxy_connect.c
      mod_proxy_ftp.c
      mod_proxy_http.c
      mod_proxy_scgi.c
      mod_proxy_ajp.c
      mod_proxy_balancer.c
      mod_ssl.c
      prefork.c
      http_core.c
      mod_mime.c
      mod_status.c
      mod_autoindex.c
      mod_asis.c
      mod_info.c
      mod_suexec.c
      mod_cgi.c
      mod_negotiation.c
      mod_dir.c
      mod_actions.c
      mod_userdir.c
      mod_alias.c
      mod_rewrite.c
      mod_so.c
    
    Thanks.
     
  6. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    5
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,609
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    You cannot tell if a module is or is not installed simply by running httpd -l to check for the list of modules, since some are shared modules and will not appear in httpd -l list (also httpd -l only works if using Apache 2.0 and 2.2 not Apache 1.3). The way to check this if the module might be shared is the following:

    Code:
    httpd -M | grep -i geoip
    
    httpd -l | grep -i geoip
    Here is a good example security2_module, which is a shared Apache module, not showing up under httpd -l and why this is necessary to use both to check it:

    Code:
    # httpd -l|grep -i security
    #
    # httpd -M|grep -i security
    Syntax OK
     security2_module (shared)
    Thanks.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. jameshurrell

    jameshurrell Member

    Joined:
    Feb 17, 2011
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    53
    Just to close this thread off - it is now working.

    I managed to sort it out by adding the following lines to the pre_main_2.conf file via WHM:

    Code:
    LoadModule geoip_module /usr/local/apache/modules/mod_geoip.so
    GeoIPEnable On
    Then I restarted Apache.

    Tristan: thank you, the code httpd -M showed: geoip_module (shared)
     
  9. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    5
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Hello,

    It is good to know that it is working now.
    Tristan, Thank you for making me aware of the difference between httpd -l and httpd -M
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice