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?

link|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
feedback

2 Answers

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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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