Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I can't get Apache to start on Fedora 15. I downloaded a project into /var/www/html and changed myself to the owner (recursively), though I don't think I changed any SELinux contexts or anything like that. When I run service httpd start I get:

Starting httpd (via systemctl): Job failed. See system logs and 'systemctl status' for details.
[FAILED]

And when I run httpd -k start as root I get:

(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80

I'm not sure why but I think it has something to do with SELinux. Any ideas?

share|improve this question

5 Answers 5

You should do what the error output says:

See system logs and systemctl status for details.

The second error message is pretty clear to me though: something is already running and using port 80. Run netstat as root to find out which program is occupying port 80:

netstat -ntlp

Maybe that's the httpd process that was started in the previous command. If so, kill it before trying again, or use restart instead of start.

share|improve this answer
    
service httpd restart output: Restarting httpd (via systemctl): Job failed. See system logs and 'systemctl status' for details. [FAILED] and systemctl --failed output: httpd.service loaded failed failed LSB: start and stop Apache HTTP Server –  23173210123987 Jun 3 '11 at 0:22

Run this command as root to find out open ports:

netstat -tpln

You'll be able to see open ports under "Local Address" column. You'll also see PID of the process using the port in the last column. Try killing the pid by:

kill -9 PID

where PID is the process ID you just found.

Apache should start now.

share|improve this answer
    
There are a couple of items (sendmail and rpc.statd) running on various ports on 127.0.0.1, but nothing on 127.0.0.1:80, should I kill those processes? –  23173210123987 Jun 2 '11 at 23:34
    
No, don't kill them. Not sure what's wrong. You should system logs for more details. –  Deepak Mittal Jun 4 '11 at 11:06
    
where? there's nothing in /var/log/httpd and systemctl --failed says: httpd.service loaded failed failed LSB: start and stop Apache HT. Where should I be looking? –  23173210123987 Jun 4 '11 at 22:42

I had this problem too, and I solved it by reinstalling Apache. Type in the terminal (after su to root, or alternatively put sudo before the commands):

# yum remove httpd
Removed HTTPD 100%
# yum install httpd
Installed HTTPD 100%

And then do your work on the .conf files

And then type in the terminal:

sudo service httpd start

That should work.

share|improve this answer

It's solved. Some cool people in freenode/#fedora helped me find out that the system-config-httpd tool made some files (/etc/httpd/conf.d/system-config-httpd.conf and /etc/httpd/conf.d/system-config-httpd.conf.bak), and by moving/removing them it worked; I'm not sure why.. something to do with systemd

share|improve this answer

Just for educational purposes I will explain: You probably used the Fedora-provided GUI-based httpd configuration utility. It creates the system-config-http.conf file. Apache loads the "normal" conf.d first (which has a listen-port specified) and starts listening on that port. Apache then loads other .conf files and processes them. The new configuration file created by the GUI utility contains (td-da!) another 'listen' directive for port 80! So Apache "sees" something already has port 80 occupied, so that is when Apache calls a halt to the startup process and exits completely.

The insideous part of all this it that you will never see port 80 occupied by anything. I've been bitten by this years ago, and just now when I installed Fedora 15. I thought surely they would have fixed their configuration utility to prevent this behavior a long time ago. Wrong!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.