Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've almost completed automating the installation and configuration of apache2 across our infrastructure, but am hung up on an intermittent issue where apache does not restart when I ask it to.

I'm installing apache via AMT get; copying across files including ports.conf, apache2.conf and the default site; then calling within my script:

/etc/init.d/apache2 restart

I'm expecting apache to be listening on 443 ONLY when all's said and done, but it's intermittently still bound to port 80. Does anyone have any ideas as to how I can guarantee the restart?

share|improve this question
Should we guess that you didn't configure it to listen on port 443? Should we guess something else? You only say that it doesn't work. And I can tell you it works for me that way. – mailq Nov 8 '11 at 23:04

You'll likely need to open up the apache2 init script and find out how it's doing the restart. Older init scripts might stop, sleep, then start. You may need to write in a loop where you sleep, then check to see if it's still running before starting again.

share|improve this answer

1) You can always Leave Port 80 open from apache2 config and block it with iptables

iptables -A INPUT -p tcp -m tcp --dport 80 -j DROP

2) You can bind 80 to localhost.

share|improve this answer

Your Answer


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.