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.

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

sudo netstat -nap | grep 0.0.0.0:443
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>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

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

share|improve this question

migrated from stackoverflow.com Nov 30 '12 at 3:50

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

2  
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

1 Answer 1

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

 
discard

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