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

My apache2 web-server starts twice and wont bind, so i have to do this:

sudo netstat -nap | grep
sudo kill -9 1243
sudo /etc/init.d/apache2 restart

Is there any way i can make a script out of the code above so that i can run automatically on start up?

I have Ubuntu 10.04, this happened after an update.

UPDATE: ports.conf - Could this be cause it:

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443

<IfModule mod_gnutls.c>
    Listen 443

could it be listening to 443 twice? or do i need to add NameVirtualHost *:443

share|improve this question

migrated from Nov 30 '12 at 3:50

This question came from our site for professional and enthusiast programmers.

Instead of wanting to write a script to kill the second process, why don't you just focus on figuring out why you have two service entries for apache? – jdi Nov 26 '12 at 17:36
i cant figure it out... this is the closest ive gotten – Relentless Nov 26 '12 at 17:41

You might want to actually address the issue of multiple versions of the apache service wanting to load, and fix the source of the problem, as opposed to writing scripts to patch up downstream issues.

One possibility is that you have apache configured to load from both the init.d and upstart. This is an old vs new service manager. See this post on the difference between upstart and init.d.

Check your /etc/init and /etc/init.d to see if they both contain apache entries. If so, you need to disable one of them. upstart is newer, so you should probably disable the older init.d (my guess).

Reference this page (amongst others) for info on how to disable or remove the init.d service: Remove Unwanted Startup Files or Services on Debian

share|improve this answer
k so i checked init and it does not contain any apache2 entries, and init.d only contains 1 apache2 file. maybe its the way i have ports.conf configured... should i add a "NameVirtualHost *:443" entry? – Relentless Nov 26 '12 at 17:56
I added my ports conf file – Relentless Nov 26 '12 at 17:59

Your Answer


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