Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Thanks for your help. I recently did the following:

  1. Ran sudo yum update on my ec2 instance running the Amazon Linux ami
  2. I then added a virtual host to my vhost.conf for a subdomain.
  3. While the server is still accessible, When I ran sudo httpd restart I received the following:

.

Stopping httpd:                                            [FAILED]
Starting httpd: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf.d/vhost.conf:1
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
                                                           [FAILED]

Also, if I run the restart command without sudo service httpd restart I receive the following message:

rm: cannot remove `/var/run/httpd/httpd.pid': Permission deniedLED]

rm: cannot remove `/var/run/httpd/httpd.pid': Permission denied
Starting httpd: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf.d/vhost.conf:1
(13)Permission denied: AH00058: Error retrieving pid file /var/run/httpd/httpd.pid
AH00059: Remove it before continuing if it is corrupted.
                                                           [FAILED]
share|improve this question
    
Looks like something's already running on port 80. –  ceejayoz Oct 9 '13 at 14:45
    
@ceejayoz, thanks for the response. I'm new to linux. How can I figure that out and then work a solution? Thanks! –  MSchwartz Oct 9 '13 at 14:48
    
@MSchwartz Seems like you are in over your head. I would recommend just rebooting the whole server in lieu of anything else. –  JakeGould Apr 13 at 22:13
add comment

1 Answer

From what you have provided seems that there is another process using port 80

Try to do the following:

First you need to be a root user to execute them, either you add sudo before the command, or before doing anything, switch to the user root like this:

su -root

and type the root password.

Then, proceed with:

netstat -tulpn| grep :80

The above command displays list of connections that are using port 80

Then execute the following command to kill the process that is using port 80

kill -9 <process id>

Replace process id with the process number that is shown on the screen from the previous command.

Then execute this command to start httpd process:

service httpd start
If the above did not work with you then try this

Try this i have just tested it:

for i in `lsof -i :80 | grep http | awk {' print $2'}`; do kill -9 $i; done

Then perform the restart:

service httpd restart
share|improve this answer
    
Thanks @MohyedeenN. After I ran netstat I got tcp 0 0 :::80 :::* LISTEN 12660/httpd. I then killed process 12660 and ran the netstat command again which then showed tcp 0 0 :::80 :::* LISTEN 13831/httpd. Is there a reason it's auto starting? After service httpd start I received this on the following comment: –  MSchwartz Oct 9 '13 at 17:05
    
Starting httpd: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf.d/vhost.conf:1 (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down AH00015: Unable to open logs [FAILED] –  MSchwartz Oct 9 '13 at 17:05
    
@MSchwartz Please see at the end of my answer i have added a piece of code execute it then restart httpd. –  MohyedeenN Oct 9 '13 at 17:40
    
no luck, same message :/ Anything with the "AH00015: Unable to open logs" error? Also, running service httpd restart without root gives me this: rm: cannot remove '/var/run/httpd/httpd.pid': Permission deniedLED] rm: cannot remove '/var/run/httpd/httpd.pid': Permission denied Starting httpd: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf.d/vhost.conf:1 (13)Permission denied: AH00058: Error retrieving pid file /var/run/httpd/httpd.pid AH00059: Remove it before continuing if it is corrupted. [FAILED] –  MSchwartz Oct 9 '13 at 17:48
1  
@MohyedeenN sending SIGKILL as a first attempt at killing a process is a bad idea since it can't clean up. –  sciurus Apr 14 at 1:59
show 2 more comments

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.