How to fix a fault with apache in SUN server

Hi,

We are logging into the SUN OS 5.9 server by using putty. We are not able to open the webpage that is using the apache server in our main server.

when i checked for my apache server, It is running fine.

It is given as

$ ps -ef|grep httpd
root 421 1 0 08:57:11 ? 0:00 //usr/lib/httpd -i admin -a
root 414 1 0 08:57:11 ? 0:00 //usr/lib/httpd -i sws_server

when i am accessing webpage it is giving error as 'File not found' and 'HTTP 404'

I dont know how to fix this issue.

If any one knows please tell me how to check for the process which is responsible for the GUI to run and process of working and loading of a GUI web page.

Can you be a little more specific and tell us what troubleshooting steps you did or didn't do. We unix admins not mind readers.:wink:

when i am trying to start the apache server fro root it is giving error as

[Thu May 15 14:43:20 2008] [crit] (125)Address already in use: make_sock: could not bind to port 80.

on Your main web server do a

telnet localhost 80
GET /

and see what's the ascii output, is it also showing "http 404" error? If it is then do a

netstat -na | grep -i listen | grep \\.80

to see what else is possibily using port 80

If GET / is not showing the "http 404" error, go to a client machine, telnet to the webserver ip address at port 80
example

telnet xxx.xxx.xxx.xxx 80
GET /

and compares the output

hello !
so you try to start the apache while another http is allready running ?
that would explain the error message because the port is allready taken by another http deamon.

the message

only states that there isnt any file to access for the httpd like no index.html in the document root of the apache.
this can only be solved bye verifying the docroot and the accessed files of the configured virtual host in the httpd.conf.

more infos can be found in the httpd logs (error.log access.log) debends on the httpd version but most likely in the apache_root/logs

Hi,

when i given

telnet localhost 80
GET /

on the server it has given a HTML script
and same also resulted when i given

telnet xxx.xxx.xxx.xxx 80
GET /

.It is not given any HTTP404 error.

and for netstat,it resulted following.

netstat -na | grep -i listen | grep \\.80
.80 *. 0 0 49152 0 LISTEN

Please help me out in resolving this issue.

I had found the following files in the document root of apache server are

-rw-r--r-- 1 webi other 2326 Jul 3 1996 apache_pb.gif
-rw-r--r-- 1 webi other 3134 Jan 27 2001 index.html.ru.ucs2
-rw-r--r-- 1 webi other 6268 Jan 27 2001 index.html.ru.ucs4
-rw-r--r-- 1 webi other 2035 Mar 22 2001 index.html.pt-br
-rw-r--r-- 1 webi other 1456 May 4 2001 index.html.en
-rw-r--r-- 1 webi other 1884 Jun 26 2001 index.html.ca
-rw-r--r-- 1 webi other 1583 Jun 27 2001 index.html.cz
-rw-r--r-- 1 webi other 1557 Jun 27 2001 index.html.dk
-rw-r--r-- 1 webi other 1877 Jun 27 2001 index.html.ee
-rw-r--r-- 1 webi other 1677 Jun 27 2001 index.html.el
-rw-r--r-- 1 webi other 3706 Jun 27 2001 index.html.he.iso8859-8
-rw-r--r-- 1 webi other 1525 Jun 27 2001 index.html.fr
-rw-r--r-- 1 webi other 1799 Jun 27 2001 index.html.es
-rw-r--r-- 1 webi other 1333 Jun 28 2001 index.html.kr.iso-kr
-rw-r--r-- 1 webi other 1526 Jun 28 2001 index.html.no
-rw-r--r-- 1 webi other 2007 Jun 28 2001 index.html.nl
-rw-r--r-- 1 webi other 1842 Jun 28 2001 index.html.pt
-rw-r--r-- 1 webi other 1497 Jun 28 2001 index.html.po.iso-pl
-rw-r--r-- 1 webi other 1591 Jun 28 2001 index.html.ru.cp-1251
-rw-r--r-- 1 webi other 1585 Jun 28 2001 index.html.ru.cp866
-rw-r--r-- 1 webi other 1589 Jun 28 2001 index.html.ru.iso-ru
-rw-r--r-- 1 webi other 2318 Jun 28 2001 index.html.ru.utf8
-rw-r--r-- 1 webi other 1585 Jun 28 2001 index.html.ru.koi8-r
-rw-r--r-- 1 webi other 1700 Jun 28 2001 index.html.se
-rw-r--r-- 1 webi other 1534 Sep 6 2001 index.html.nn
-rw-r--r-- 1 webi other 2274 Sep 17 2001 index.html.de
-rw-r--r-- 1 webi other 1847 Nov 7 2001 index.html.it
-rw-r--r-- 1 webi other 1799 Dec 14 2001 index.html.ja.jis
-rw-r--r-- 1 webi other 1896 May 21 2002 index.html.lb.utf8
-rw-r--r-- 1 webi other 1062 May 21 2002 index.html.zh
-rw-rw-r-- 1 webi other 1335 Jun 13 2006 index.htm

In httpd.conf file the directory index is defined as

# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
DirectoryIndex enter.htm index.html index.htm

Maybe there's another http process has started before your apache.

You have to try to check /etc/init.d /etc/rc2.d /etc/rc3.d

check all the SXX (XX is number, the number denotes the starting sequence)

cd /etc/init.d
grep -i httpd *

cd /etc/rc2.d
grep -i httpd *

cd /etc/rc3.d
grep -i httpd *

look for some other startup script that could be starting http process before apache.

grep -i will search all the scripts in the directory for pattern called "httpd" and list the filename that contains it.

can you post the output of
#> httpd -t -S

The results for the commands are:

cd /etc/init.d
grep -i httpd *

grep: can't open esmrc
grep: can't open netbios
grep: can't open rc.oracle

cd /etc/rc2.d
grep -i httpd *

grep: can't open K69esmrc
grep: can't open S98netbios
grep: can't open S99rc.oracle

cd /etc/rc3.d
grep -i httpd *

grep: can't open S69esmrc

I dont know what these mean.

But in error log file it is showing as

[Thu May 15 14:43:20 2008] [crit] (125)Address already in use: make_sock: could not bind to port 80

Please address me in resolving this issue.

Thanks for replying

I had tried these commands in normal and root user, but same result

httpd -t -S
httpd: Command not found

> httpd -t -S
-t: Command not found

> httpd -S
-S: Command not found

you need to be root and try grep again

This is the result in root user.

# cd /etc/init.d
# grep -i httpd *
# cd /etc/rc2.d
# grep -i httpd *
# cd /etc/rc3.d
# grep -i httpd *

try grep http instead of httpd?

ok your httpd executable is not in your $PATH whatever then execute

/usr/lib/httpd -t -S

Perhaps you should decide whether you are trying to restart your web server, or trying to find out why you get a 404. What is the URL you get the 404 for and do you have reason to believe that the requested document ought to exist in the document tree at the given path?

# cd /etc/rc2.d
# grep -i http *
S95http: touch $BASEDIR/var/http/.initialized
S95svm.sync: echo "Troubleshooting section, at http://docs.sun.com or from"
# cd /etc/rc3.d
# grep -i http *
# cd /etc/init.d
# grep -i http *
httpd: touch $BASEDIR/var/http/.initialized
svm.sync: echo "Troubleshooting section, at http://docs.sun.com or from"

and for

/usr/lib/httpd -t -S

the result i got is :

Usage: {<flag>}
-a Start administration server.
-c <config file name> Server configuration file.
-i <instance name> Server instance name.
-I Run as child of inetd.
-v Check configuration file syntax.
-V Display SWS version number.

I am thinking that " because of the non running of apache server only the web page error is coming. But by restarting the main server also the apache server is not started automatically. I don't know which file is missing for that web page. i had found all the files that are in httpd.conf file.

But i dont know which file is missing.

You should be able to see from error.log which URL the client tried to retrieve. Unless there is mod_rewrite voodoo or CGI involved, it should map straightforwardly to a local file. If you have seen that 404 error then you should be able to figure out which URL it was for.