newmarylandjersey
newmarylandjersey

Reputation: 111

httpd is not starting

I am root and I can't start httpd.

I executed /etc/init.d/httpd status and got:

httpd is stopped

when I try /etc/init.d/httpd start, I get:

Starting httpd: (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED]

I thought it might be hung so I checked sudo netstat -tulpn | grep :80.

I got nothing.

I checked /var/log/httpd/error.log and it has nothing related to that

Just to try, I tried /etc/init.d/httpd reload I got [FAILED].

What do I need to do?

Upvotes: 0

Views: 14978

Answers (3)

Elham_Jahani
Elham_Jahani

Reputation: 367

make sure about "listen PORT" config in your config file

i mean you can not have two line with

Listen 80

in your httpd.conf file (OR one Listen 80 in httpd.conf and one in another config file like welcome.conf)

Upvotes: 0

Santa's helper
Santa's helper

Reputation: 996

First of all we need find out which service occupy the port 80

netstat -anp |grep LISTEN |grep ":80"

with this cmd you will learn the service and if it's not the service you want stop and it start your httpd (apache) service.

For my server its nginx not apache and the response of the cmd is like this:

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      10266/nginx: master 
tcp6       0      0 :::80                   :::*                    LISTEN      10266/nginx: master 

which means pid : 10266 (nginx) is useing port 80

Upvotes: 1

sitakant
sitakant

Reputation: 1878

grep the process and kill them . Then after try to restart the apache. This might solve your problem.

ps -ef | grep httpd

kill -9 <PID>

Upvotes: 0

Related Questions