Archive for June, 2009

SBDavid

Apache Error: Unable to open logs

Apache Error: Unable to open logs

Sometimes apache will fail to start. It will show the following error message in apache error logs:

Unable to open logs

This is because of the low number of file descriptors. Check the current limit of file descriptors in the file /proc/sys/fs/file-max:

$ cat /proc/sys/fs/file-max
1024

If fs.file-max is quite small (several thousands or so), it should be changed to a higher value.

$ echo “65535″ > /proc/sys/fs/file-max

If you want this new value to survive across reboots you can add it to /etc/sysctl.conf.

# Maximum number of open files permited
fs.file-max = 65535

To load new values from the sysctl.conf file:

$ sysctl -p /etc/sysctl.conf

Hint: Add `ulimit -n 65536` command to /etc/rc.d/init.d/httpd or /etc/init.d/httpd and /usr/sbin/apachectl apache startup scripts at the top.

Configure Apache to listen multiple ports

The listen directive in the Apache configuration file can be used to make Apache to listen in a particular port or IP address or port combination.

Listen 80
Listen 8000

In this format the Apache server listens on the given ports on all interfaces (IP addresses) which are up in the server. If you mention the above two directives in the Apache configuration file then the Apache server will listen on both the ports 80 and 8000. Multiple Listen directives may be used to specify a number of addresses and ports to listen to.

Listen IP:80

You need to replace the IP address in this example with the IP address you want the Apache service to listen. In this format an IP address is given as well as a port. In this case the server will listen on the given port and interface( IP address ). If you want the Apache service to listen on two IP addresses in the server you can use multiple listen directive in the configuration file.

Listen IP1:80
Listen IP2:80

Please remember to restart the Apache service in the server once the changes are made to the configuration file.

SBDavid

What is mod_evasive?

What is mod_evasive?

mod_evasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is also designed to be a detection and network management tool, and can be easily configured to talk to ipchains, firewalls, routers, and etcetera. mod_evasive presently reports abuses via email and syslog facilities.

Detection is performed by creating an internal dynamic hash table of IP Addresses and URIs, and denying any single IP address from any of the following:

* Requesting the same page more than a few times per second
* Making more than 50 concurrent requests on the same child per second
* Making any requests while temporarily blacklisted (on a blocking list)

Downloads:

Stable [ Version 1.10.1 ] mod_evasive for Apache v1.3 and 2.0
SBDavid

Apache HTTP server benchmarking tool

Apache HTTP server benchmarking tool

ApacheBench is actully a command line program for measuring the performance of HTTP web servers. It was designed to give an idea of the performance that a given Apache installation can provide.

For bench marking the apache we can use the tool ab.

ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per sec-ond your Apache installation is capable of serving.

The syntax for using the tool is as follows.

$ ab -n 10 -c 2 http://www.your-domain-name.com/index.html

-n: specifies the number of request that is to be sent to the apache server for the bench marking session.
-c: specifies the number of multiple requests to perform at a time to the server.

SBDavid

WHM failed to receive Apache Status

WHM failed to receive Apache Status

If the WHM is not showing the Apache status, make sure that the whm-server-status is added in the configuration.

$ vi /usr/local/apache/conf/httpd.conf

Then add the following entries in the Apache configuration file and then save.

<Location /whm-server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
ExtendedStatus On

Restart the apache service.

$ /scripts/restartsrv_httpd

« Prev - Next »