≡ Menu


Vbulltin PHP Xcache Displaying Same Forum Data For Both Boards Error and Solution

Q. I've followed your Xcache php 5.x opcode cacher installation under RHEL 5 for my vbulltin board. I see good boosting in performance. Now I've installed 2nd VB forum on the same server and I see all sub-forums hosted from 1st forum. So I had to disable Xcache. I want Xcache for both board on same host. How do I fix this mess?
[click to continue…]

Monitor HTTP Packets ( packet sniffing )

How do I monitor and analyze data transferred via HTTP (apache or lighttpd or nginx webserver) for debugging and security purposes?
[click to continue…]

What Is Tux Web Server and How do I Use it?

Q. Can you explain the tux web server and its usage against regular apache httpd web server?
[click to continue…]

Start / Stop / Restart Lighttpd Web Server on Linux / Unix

I'm unable to find any command(s) to stop lighttpd web server. How do I stop / start / restart Lighttpd on Debian/Ubuntu Linux installed using apt-get command? How do I restart lighttpd on RHEL / CentOS installed using yum command? How do I restart lighttpd on FreeBSD Unix operating systems?
[click to continue…]

Linux Blog Software

Q. I've Debian Linux VPS server for my small business web site. Can you tell me more about a free blog software (weblog software) that can run under LAMP?
[click to continue…]

Fingerprint / Identify Remote Web Server

Q. How do I fingerprint or identify remove web server a from UNIX / Linux shell prompt?
[click to continue…]

Redhat / CentOS / Fedora Linux Install XCache for PHP 5

How do I install Xcache opcode cacher for PHP 5 under RHEL / CentOS version 5.0 server?
[click to continue…]

How to: Measure the Lateceny and Throughput of Apache / Lighttpd / IIS Webserver

Q. I can measure network throughput and packet loss using standard UNIX / Linux command line utilities. How do I find out the lateceny and throughput of a web server like Apache under Linux?

A. You need to use the program called httping. It allows you to measure the latency of a webserver and the throughput.

Task: Ping the webserver on host www.cyberciti.biz

Use the following command for measuring the latency. Press CTRL+c to exit the program. It will display a summary of what was measured.
$ httping -g http://www.cyberciti.biz

PING www.cyberciti.biz:80 (http://www.cyberciti.biz):
connected to www.cyberciti.biz:80, seq=0 time=981.08 ms
connected to www.cyberciti.biz:80, seq=1 time=709.92 ms
connected to www.cyberciti.biz:80, seq=2 time=1072.02 ms
connected to www.cyberciti.biz:80, seq=3 time=903.81 ms
connected to www.cyberciti.biz:80, seq=4 time=607.84 ms
connected to www.cyberciti.biz:80, seq=5 time=660.01 ms
connected to www.cyberciti.biz:80, seq=6 time=730.12 ms
connected to www.cyberciti.biz:80, seq=7 time=781.49 ms 

The -g url option use selects the url to probe / ping. You can also specify the port with -p port option:
$ httping -g http://www.cyberciti.biz -p 81
You can also connect using SSL, for this to work you need to give a https url or a 443 portnumber:
$ httping -l -g https://www.cyberciti.biz
$ httping -g http://www.cyberciti.biz -p 443

Task: Measure throughput of a webserver

The -G option force GET request instead of a HEAD request - this means that also the complete page/file must be transferred. You also need to pass the -b option with -G option to get the transferspeed (in KB/s).
$ httping -Gbg http://www.cyberciti.biz/

PING www.cyberciti.biz:80 (http://www.cyberciti.biz/):
connected to www.cyberciti.biz:80, seq=0 time=1738.39 ms  22KB/s
connected to www.cyberciti.biz:80, seq=1 time=1650.19 ms  20KB/s
connected to www.cyberciti.biz:80, seq=2 time=1759.65 ms  17KB/s
connected to www.cyberciti.biz:80, seq=3 time=1589.98 ms  21KB/s
connected to www.cyberciti.biz:80, seq=4 time=3709.87 ms  6KB/s
connected to www.cyberciti.biz:80, seq=5 time=3329.69 ms  7KB/s
--- http://www.cyberciti.biz/ ping statistics ---
53 connects, 53 ok, 0.00% failed
round-trip min/avg/max = 1451.9/2013.6/11656.0 ms
Transfer speed: min/avg/max = 6/19/24 KB

Please note above in above command you’re no longer measuring the latency!

You can also pass -X option with -G to show the amount of data transferred (excluding the headers):
$ httping -XGbg http://www.cyberciti.biz/

PING www.cyberciti.biz:80 (http://www.cyberciti.biz/):
connected to www.cyberciti.biz:80, seq=0 time=1576.11 ms  22KB/s 19KB
connected to www.cyberciti.biz:80, seq=1 time=2620.26 ms  9KB/s 19KB
connected to www.cyberciti.biz:80, seq=2 time=1507.69 ms  23KB/s 19KB
connected to www.cyberciti.biz:80, seq=3 time=1522.08 ms  24KB/s 19KB
connected to www.cyberciti.biz:80, seq=4 time=1533.68 ms  23KB/s 19KB
connected to www.cyberciti.biz:80, seq=5 time=1581.92 ms  21KB/s 19KB
connected to www.cyberciti.biz:80, seq=6 time=1512.06 ms  24KB/s 19KB
--- http://www.cyberciti.biz/ ping statistics ---
7 connects, 7 ok, 0.00% failed
round-trip min/avg/max = 1507.7/1693.4/2620.3 ms
Transfer speed: min/avg/max = 9/21/24 KB

Test remote server CPU

The -B option along with -G option ask the HTTP server to compress the returned data - this will reduce the influence of the bandwidth of your connection while increasing the influence of the processorpower of the HTTP server.
$ httping -BGg http://www.cyberciti.biz/

Flood Webserver

The -f option used to flood ping i.e. do not sit idle between each ping but ping as fast as the computer and network allow you to (don't run this on production or 3rd party servers):
$ httping -fg http://www.cyberciti.biz/

Lighttpd as you compiled without pcre support error and solution

Q. I'm using lighttpd under CentOS 5 and getting the following error:
...can't handle '$HTTP[url] =~ …' as you compiled without pcre support.

My question is What is pcre support, and how do I solve this problem?

A. Pcre is nothing but Perl-compatible regular expression library. PCRE has its own native API, but a set of "wrapper" functions that are based on
the POSIX API are also supplied in the library libpcreposix. You must compile lighttpd with pcre to support lighttpd regex style config option. pcre-devel package provides the development files (Headers, libraries for static linking, etc) for pcre. Install the following package and rebuild your lighttpd:
# yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel

Now change directory to lighttpd source code and recompile Lighttpd with pcre option:
# make clean
# ./configure
# make
# make install

Now restart lighttpd and it should support pcre style config options.

Lighttpd virtualhost configuration ~ name-based virtual hosting

Q. How do I configure lighttpd web server as virtual host for serving multiple web site from a single public IP address (name-based virtual hosting)?

A. Virtual hosting is a method that servers such as webservers use to host more than one domain name on the same server, sometimes on the same IP address.

There are two basic methods of accomplishing virtual hosting .
(A) name-based virtual hosting : You use multiple host names for the same webserver IP address. For example domain nixcraft.com and theos.in uses same IP address called

(B) ) IIP address / ip-based virtual hosting

How do I configure Lighttpd for name-based virtual hosting?

Let us say your setup is as follows:

  • Public IP address:
  • Domain names: domain1.com and domain2.net
  • Default Document Root: /home/lighttpd/default/http
  • Default Document Root for domain1.com: /home/lighttpd/domain1.com/http
  • Default Document Root for domain2.net: /home/lighttpd/domain2.net/http

First, create required directories:
# mkdir -p /home/lighttpd/default/http
Next, open lighttpd.conf file:
# vi /etc/lighttpd/lighttpd.conf
Setup default document root:
server.document-root = "/home/lighttpd/default/http/"
Setup public IP address:
server.port = 80
server.bind = ""

At the bottom of the file, add:
include "domain1.com.conf"
include "domain2.net.conf"

Save and close the file.

Create domain1.com virtual host configuration

Create required directories:
# mkdir -p /home/lighttpd/domain1.com/http
# mkdir -p /home/lighttpd/domain1.com/logs

Open /etc/lighttpd/domain1.com.conf file:
# vi /etc/lighttpd/domain1.com.conf
Add following configuration directive:

$HTTP["host"] =~ "domain1\.com" {
            server.document-root = "/home/lighttpd/domain1.com/http"
            accesslog.filename         = "/home/lighttpd/domain1.com/logs/access.log"

Save and close the file.

Create domain2.net virtual host configuration

Create required directories:
# mkdir -p /home/lighttpd/domain2.net/http
# mkdir -p /home/lighttpd/domain2.net/logs

Open /etc/lighttpd/domain2.net.conf file:
# vi /etc/lighttpd/domain2.net.conf
Add following configuration directive:

$HTTP["host"] =~ "domain2\.net" {
            server.document-root = "/home/lighttpd/domain2.net/http"
            accesslog.filename         = "/home/lighttpd/domain2.net/logs/access.log"

Save and close the file.

Restart the lighttpd web server:
# /etc/init.d/lighttpd restart

Make sure document root is owned by your web server user such as www-data or lighttpd:
# chown -R lighttpd:lighttpd /home/lighttpd/