Category: Apache

Apache 1.3 and 2.x Tips and tricks

Apache, Linux

Compiling an Apache module after Apache is been compiled

Sometimes one discovers a module which would be lovely to include in an already compiled Apache. I’m using here an example of a vanilla Apache I compiled. Constants: Source path of Apache: /www/src/ Path of compiled Apache: /www/apache/ Module to compile: proxy_http Compiling the module: cd /www/src/modules/proxy /www/apache/bin/apxs -i -a -c mod_proxy_http.c This will: – …

Apache, Linux

Load Balancing with Apache

Introduction: I’ve been confronted with the task of installing 2 web servers and a load balancer all made of Apache2. Requirements: – 1 Load balancer made of apache2 configured for 2 Web sites – The load balancer should implement Cookies based stikyness for clients to land all their requests on the same web server initially …

Apache, Linux, Uncategorized

Changing the URL of WordPress

Lately after a friend had develloped a new web site under (eg.)new.mywebsite.com when it needed to go live to www.mywebsite.com although the admin settings were changed and the Apache configuration as well, many links still were pointing to new.mywebsite.com. Now what to do? I searched the Net and found this great beb site which explains …

Apache, Linux

Combining Apache PHP module and fcgi in Debian Squeeze/Wheezy

Many help sites that show you how to install and configure the Apache module mod_fcgid ask you to uninstall the Generic Apache PHP module(mod_php5). Although mod_fcgid offers some advantages to the mod_php5, uninstalling the mod_php5 need not be, especially if you are running applications that don’t need to run under mod_fcgid and it uses simple …

Apache, Linux

Warning: curl_exec() has been disabled for security reasons

In Powerpress plugin of WordPress I’ve been confronted with this error: Warning: curl_exec() has been disabled for security reasons Many people suggested a hack into the functions.php of WordPress. I find this solution not very good, since it’s most likely all gone after an update of WordPress. After looking for a better solution in Google …

Apache, Linux

PHP problem of ‘basedir-open’

After having upgraded Apache, PHP and other PHP modules I found out that we had problems with errors regarding restrictions of opening files within the set htdocs directory. I found that out by enabling error messages to be shown in the php.ini file. After researches on Internet I found those sites where they also had …

Apache

Detecting Browser User Agent in Mod_Rewrite

Apache mod_rewrite can be used to detect whether a browser has a WAP or Smartphone device versus a normal size browser and act accordingly. Here is a method: Creating variables for different sorts of portable devices: # Wap devices BrowserMatch “MIDP” WAP_DEVICE BrowserMatch “CLDC” WAP_DEVICE BrowserMatch “UP\.” WAP_DEVICE BrowserMatch “HTC” WAP_DEVICE BrowserMatch “LG” WAP_DEVICE BrowserMatch …

Apache

Installing Google’s Apache mod_pagespeed module.

Google has recently published an Apache module which should optimize web sites delivery daynamically. I was quite suspicious about such tool and though that this could only work at the costs of page outlook quality, meaning web pages not being displayed quite the same as the original. After experimenting with it I was quite please …

Apache

Configuring Apache2 mod_deflate

Here are some recommended settings of the mod_deflate in Apache2. The main principle is to define which type of files are and which ones are not to be compressed. These settings DON’T override the fact that if a device/browser doesn’t have the following header in its request the requested file/component will NOT be compressed at …

Apache, Linux

Using Environment variables in Apache rewrite rules

Problem: Setting multiple variables(%1-%9) in rewrite rules with RewriteCond will get rewritten by the subsequent RewriteCond for the same rewrite rule pack. eg. RewriteCond %{REQUEST_URI} ID([^/]+) RewriteCond %{REQUEST_URI} ID2([^/]+) RewriteRule ^/login.php /newlogin.php?NewID=%1&NewID2=%2 The above rule is not practical in real world, there are better ways to do this. But just as an example, we can …

Apache

Setting a Cookie from Query String

In some very special task we needed (don’t ask me why) to use the value of the Query string to set a response cookie. Meaning we grab the query string in a format of Name=value to set a cookie in the response header. eg. http://www.myserver.com/myimage.gif?mycookie=myvalue sets the cookie in the client’s browser as: Name of …

Apache, Linux

Installing eAccelerator for PHP in Debian Squeeze

This great application really speeds-up the processing and therefore delivery of complex web sites based on PHP, for example from CMS like Typo3. Here is how to install it. Credits FROM: http://www.debiantutorials.com/installing-eaccelerator/ and https://github.com/eaccelerator/eaccelerator/wiki/InstallFromSource Instructions in German: http://www.sysadminslife.com/linux/eaccelerator-php-beschleuniger-installation-unter-debian-5-lenny-und-ubuntu/ Download it cd /tmp wget http://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-0.9.6.1.tar.bz2 Unpack it tar -xvjf eaccelerator-0.9.6.1.tar.bz2 Prepare for compiling it apt-get install …

Apache, Linux

Solving the problem of MaxRequestLen in mod_fcgid

Sometimes we get the following message in error.log and sometimes not. The reason is that the size of MaxRequestLen is not high enough: mod_fcgid: HTTP request length 135714 (so far) exceeds MaxRequestLen (131072) Solution: Add the following entry in the file: /etc/apache2/mods-available/fcgid.conf raise the value from the default 131072 to 15728640 (15MB) or higher if …

Apache, Linux

Compiling and install the missing dotdeb php5-fileinfo package

Dotdeb has done a terrific job at precompiling some PHP 5 packages and environment for us. Unfortunately in Dotdeb version of Debian Squeeze PHP5 packages I found the package php5-fileinfo to be missing. So here are the blind steps (without explanations) on how to compile and install this package. This is just an example unig …

Apache

Using cache control with Apache

This article has no structure really. It is a gathering of important information and own findings concerning caching of web elements. Caching controls of web elements General rules: – The header ‘Expires:’ is an implementation of the HTTP/1.0 – The header ‘Cache-Control: max-age=xxxx’ is an implementation of the HTTP/1.1 and OVERRIDES ‘Expires:’ Extract from http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html: …

Apache, Linux

Web client authentication using SSL/PKI and PHP

To authenticate web clients using a browser is no difficulty when one has imported the PKI certificate in the browser. But how can we do that with a php driven process and use it as client. Here is some short PHP code that will do exactly that. Note: the CA, PKI certificate(CRT) and private key(KEY) …

Apache, Linux

Installing and configuring Apache2 mod_secutity on Debian Squeeze

Install the Debian version of mod_security packages from Debian reposirory apt-get install libapache-mod-security Create an Apache config directory for mod_security mkdir /etc/apache2/modsecurity-core-rules chmod 600 /etc/apache2/modsecurity-core-rules Download and install the mod_security core rules wget http://www.modsecurity.org/download/modsecurity-core-rules_2.5-1.6.1.tar.gz tar vfx modsecurity-core-rules_2.5-1.6.1.tar.gz -C /etc/apache2/modsecurity-core-rules/ Create a symlink to adapt to all mod_security core rules(or change all the rules 🙂 ln …

Apache, Linux

Web Authentication using LDAP

These instructions have nothing special about them. There are many such instructions on the internet. The purpose here is only as reference for myself and maybe you as well. Here I’m assuming that you have installed openLDAP and created users and groups in LDAP server. In the following examples the users and groups login names …

Apache, Linux

LDAP Installation in Debian Lenny + Web LDAP Browser

NOTE: These instructions are assuming that the LDAP client runs on the same machine as the LDAP server runs. Environment: IP: 192.168.100.27 LDAP Client Machine names: ldapc.itmatrix.srv ldapc LDAP Server Machine names: ldaps.itmatrix.srv ldaps NOTE: This tutorial is a short and updated version of the one found at: http://techpubs.spinlocksolutions.com/dklar/ldap.html Edit /etc/hosts and se the content …