Search This Blog

Sunday, June 06, 2010

Common Issues in apache

When we ever face any issue with an apache server, First we need to check the Error log
In the case of apache server configured in Cpanel the error log is

/usr/local/apache/log/error_log

1# ) "500: Internal Server Error"

Fix

This may be a error with

1. File Permissions
2. script uploaded to the Improper location in the server.
3. Uploaded the script in binary mode while trying to uploaded through the FTP client
a. If it is a perl script you can check the script in the following ways
1. perl -wc scriptname.pl
This will check for the syntax errors in the script
2. perl -w scriptname.pl
This will help to diagnose the error from the error message from perl interpreter
4. Also check the Executable bit settings.

2#) The Error 404 "Page not found”

Fix

First we have to check the error log of the server.


Check for the file whether it existing or not.

Note that sometimes the file may present at the location but the page may be redirected to somewhere else through the .htaccess redirection.

Also we need to check that whether the URL specified by the client is correct

Also check whether is loading from the cached server. That means if a site containing a section which is changing frequently the error may occur due to the caching problem.

3# ) Domain is not loading.

1. Check whois record of the domain name.
You can verify this from the several sites such as (www.whois.net, centralops.net) etc.
2. If it is correct , check whether it is updated recently. (There will be certain propagation delay for the proper resolving of the domain globally, If it is updated recently)
3. Check the /etc/named.conf
4. Check the nameservers are pointing to the correct server. If yes please check the A record in the DB record is correct.
4#) Apache is not loading after some changes made in the httpd.conf

And if you don’t have a backup file for it

Then do a ./apachectl configtest (From the Binary directory of it.)

5#) “connection reset by peer” Issue

1. This may due to , someone typed in the wrong address or just got impatient while waiting for your site to load (May be trying to reload the site several time while loading the site)
2. Conjunction issues due to several connection to the server.
You can check the number of connections by the script given below.

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1

6# ) When we are facing the issue "setgid: Invalid argument" at startup?


Group directive (probably in conf/httpd.conf) needs to name a group that actually exists in the /etc/group file. This may be due to when a negative number is used in the Group directive

7#) The domains not loading. If it is showing a blank page.

Please check whether there is more than two PHP versions are installed if add proper add handler.

May the sites requires fastcgi for its proper functioning.

Solution::

Compile PHP with fastcgi option and Add the following in the .htaccess file

AddHandler fastcgi-script fcgi
AddHandler php-cgi .php
Action php-cgi /cgi-sys/php5

8#) "Error 1.1 while fetching url http://localhost//cgi-sys/cp_ea3_cgi_test.cgi"

If you are getting the below error while recompiling apache using Easyapache, check whether the permissions for /usr/local/bin/perl is 755, if the permissions are wrong gave the correct permissions are check.

9#) If you are getting errors on easyapache like.

Internal Server Error

Premature end of script headers: /usr/local/cpanel/whostmgr/docroot/cgi/easyapache.pl: Please check / usr / local / cpanel / logs / error_log for the exact error.


cpsrvd/11.24 Server at 66.207.175.114

Try updating cpanel and if it does not fix the issue, try the below steps.

==
mv /home/.cpan /root
cpan (this puts you into cpan command prompt)
install Bundle::CPAN
reload cpan
reload index
exit (this returns you to normal command prompt)
/scripts/checkperlmodules --full
==




10#) If you find the errors in Apache error logs as follows:

No space left on device: Couldn’t create accept lock [or]
No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed

Fix:

ipcs -s | grep nobody
for i in `ipcs -s | grep nobody | awk ‘{print $2}’`; do ipcrm -s $i; done

The above errors will occur if the Apache user occupies a great number of semaphores

11#) Error from domain’s error log:

mod_security: Access denied with code 403. Error reading request body, error code 70007: The timeout specified has expired

Fix :

Increase the value of timeout in the /usr/local/apache/http.conf to 300

Then restart the apache server.


12#) Apache is not starting..

build_apache_conf
Path: /usr/local/cpanel/bin/build_apache_conf

Running this script may resolve the issue.

Then try to start the apache
/etc/init.d/httpd start

No comments: