Apache

Block or redirect using mod_geoip

PDF

Installing mod_geoip allows you to block or redirect traffic based on the geografical location of the client using the IP-address of the client. mod_geoip for CentOS is available at the EPEL repository. If you haven't setup the EPEL repository follow the instructions explained on their website. I asume you allready installed Apache. Download and install mod_geoip, GeoIP and the related libraries:

 

Prevent hotlinking with mod_rewrite

PDF

To prevent that someone is hotlinking to your content (images, video ect) you can use mod_rewrite.Create a .htaccess file in the root directory of your webserver (or edit your if you allready have one) and add these lines:

 

Basic Apache security

PDF

A very basic thing you should do if you are running a webserver is hiding the operating system and software version. By default Apache shows the operating system, Apache version and the used modules. To change the full exposure you have to change the value of ServerTokens directive in /etc/httpd/conf/httpd.conf

Open /etc/httpd/conf/httpd.conf and find and change the line:

 

Setup user/password authentication for Apache

PDF

If you don't want everybody to access your website, you can restrict access to your website or part of it with user/password based authentication. First you should change the Directory directive in the config file of Apache. Open /etc/httpd/conf/httpd.conf and find the Directory directive for which you want to use user/password based authentication, i.e. <directory />, add or change the line starting with AllowOverride:

Tags:
 

Running Apache in chroot jail

PDF

Running Apache chrooted and configured right Apache and it's child processes (php, cgi scripts) cann't access anything above the ChrootDir if running as a non-root user. You can easily setup an Apache chroot jail using mod_chroot. You should keep in mind that you never create special device files, suid binaries and hardlinks with the chroot directories and do not run apache, php or perl as root.

How to setup Apache in a chroot jail?

 
Page 2 of 2

Search






You are here: Home Howtos and FAQs Apache