HTTP Error 500

georgopanos used Ask the Experts™
I am trying to help a friend and after editing a few files the site is getting an error 500
attached are a few files from the web site
If I type the domain/index-static.html it loads but no links are working

the domain is

I am not sure what needs to do any guidance would be appreciated

I know the site is hosted on amazon server could this be from their side or could it be a scripting error?

here is the .htaccess file

GeoIPEnable on

Deny from all
Allow from env=AllowCountry

RewriteEngine on

#Redirect 301 /index.html /index.php
Redirect 301 /about.html /about.php
Redirect 301 /faq.html /faq.php
Redirect 301 /recently_purchased.html /recently-purchased.php
Redirect 301 /contact.html /contact.php
Redirect 301 /sell.html /sell.php
Redirect 301 /blog.datlas.html /blog.datlas.php
Redirect 301 /philadelphia.html /philadelphia.php
Redirect 301 /pennsylvania.html /pennsylvania.php
Redirect 301 /victorian_jewelry.html /victorian-jewelry.php
Redirect 301 /art-nouveau-beauty-of-nature.html /art-nouveau-beauty-of-nature.php
Redirect 301 /edwardian-style-hail-to-the-king.html /edwardian-style-hail-to-the-king.php
Redirect 301 /faberge-a-life-of-its-own.html /faberge-a-life-of-its-own.php
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Ah... libapache2-mod-geoip... Only for the brave hearted...

I've had to setup this beast for clients before.

Looking around for good tutorials, I'd say this.

1) Install latest Ubuntu before you start this process.

If you try doing this on CentOS (shudder) or Windows (double shudder), you'll likely have to invest a significant amount of time, translating the simple Ubuntu setup to your target OS. looks to be a good starting point.

I like this particular tutorial, because they provide a few incremental debug/test steps.

Note: Do the incremental debug/test steps, which will verify you've actually installed + configured this module correctly.

This step is very important, as this is a complex beast to setup.

Also, one essential step, every single tutorial I've read skips over is updating your /usr/share/GeoIP database files every night.

To keep your GEO system working, you must also create CRON job (nightly or weekly) to update all your databases.

The way I do this is check the timestamp on all the database files at the maxmind site (see tutorial). It a timestamp is different on any database, I download the databases changed + then bounce Apache.

Bounce - service apache2 reload - or if you use another OS, you may have to do a restart.


Let me add to the original question my friend logged in to edit on of the PHP files and nothing else and after that the server was giving a 500 error.
Principal Software Engineer
David is correct.  The geoIP module is difficult to configure and geoIP in general is unreliable.

The fact that a CIDR block is owned by a company in country X does not mean that CIDR block is located in country X.  There is a thriving business in "renting" CIDR blocks to ISPs and while those CIDR blocks might be located in the US, they also might be registered anywhere worldwide.

GeoIP also often disallows US clients who use Tor.  Tor exit nodes can be located anywhere worldwide and they are assigned at random.  The same is true for VPN servers.

Customers who subscribe to VPN "privacy" services often appear to be coming from well outside the US.

If you want to use geoIP, the iptables add-ons module is easier to get running, configure, and much easier to check for correct operation (see below).  If you're determined to use the Apache geoIP module, leave that for last until everything else is working.  Disable loading the module and conditionalize all its setups.


# /etc/iptables/script02
# This script is executed in sequence when /etc/init.d/iptables
# is called during the startup process.
# These rules are permanent lockouts of specific country codes as
# determined by the GeoIP database in /var/geoip.
# Note:  Keep the GeoIP database current using the shell scripts.


# Delete all rules in any pre-existing chain
#  (Suppress error messages)
$iptloc -F GeoIP > /dev/null 2> /dev/null

# Flush any pre-existing chain
#  (Suppress error messages)
$iptloc -X GeoIP > /dev/null 2> /dev/null

# Declare a new iptables chain for these rules
$iptloc -t filter -N GeoIP

# RULES BEGIN ============================================

# Anonymous Proxy
$iptloc -t filter -A GeoIP -m geoip --src-cc A1 -j REJECT

# Abu Dhabi
$iptloc -t filter -A GeoIP -m geoip --src-cc AE -j REJECT

# Afghanistan
$iptloc -t filter -A GeoIP -m geoip --src-cc AF -j REJECT

# .... script continues for about 200 countries ...

# Zimbabwe
$iptloc -t filter -A GeoIP -m geoip --src-cc ZW -j REJECT

# RULES END ============================================

# Return to the calling chain
$iptloc -t filter -A GeoIP -j RETURN

# Now insert a call to this chain at the end of INPUT
$iptloc -I INPUT 3 -p tcp -j GeoIP

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial