Archive
Posts in Web
Simplifying Apache chroot creation with mod_chroot
Building and maintaining Apache chroot environments can be a royal pain. Creating a chroot environment for Apache requires you to first identify all the libraries and applications that are required to run the httpd processes. Once you identify the dependencies, you need to create a chroot environment that contains these files. After you successfully create the chroot environment, you need to update it when security and reliability updates are released…
$ read more →Changing the server name Sun One Web Server reports
I am a big fan of the Sun One Web Server, although I dislike the fact that it provides the server software and version by default in the HTTP header: Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. HEAD / HTTP/1.0 HTTP/1.1 200 OK Server: Sun-ONE-Web-Server/6.1 Date: Fri, 23 Feb 2007 22:41:21TGMT:00-04:00 Content-length: 179 Content-type: text/html Last-modified: Tue, 20 Feb 2007 14:30:21 GMT Accept-ranges: bytes Connection: close Connection closed by foreign host…
$ read more →Customizing PHP builds
A few weeks back I helped a friend build PHP on a server with a non-standard directory structure. Changing the structure to use common defaults wasn't an option, so we needed to adjust the PHP configure script to point to the pertinent places. Here is what we came up with: This will build PHP using an apxs utility that resides in /home/apps/bin/apxs, and will look for the MySQL, libxml and zlib libraries and headers in /home/apps/lib and /home/apps/include.
$ read more →Using wildcards in Apache server aliases
Apache allows you to create hundreds of virtual host containers. Each container is required to have a ServerName directive, which contains the domain name associated with the virtual host. In addition to a server name, one ore more aliases can be associated with the virtual host with the ServerAlias directive. Aliases can contain a domain, or a regex that allows you to match based on some specific criteria…
$ read more →Measuring Apache request processing time
I support a fair number of Apache web server instances, and periodically need to measure the time it takes Apache (and it's various modules) to process a request. On Solaris 10 hosts, I can use DTrace to retrieve this information on the fly. Since Solaris 9 and CentOS and Redhat Linux don't come with DTrace, I use a different approach on these platforms. To get the time when each request was received by Apache, I used mod_header's "Header" directive, and "%t" option (time when a request was received, measured in milliseconds from the epoch), to add a response header with the time each request was received: To get the total time Apache spent processing a request, I use mod_header's "Header" directive, and "%D" option (milliseconds spent processing the request), to add a response header with the total time Apache spent processing each request: Since I don't always need the headers to be present, I like to be able to enable and disable them from the command line…
$ read more →