Do I have 2 different Apache installations on my VPS

I'm new to server maintenance, and am running Apache 2.4 on Ubuntu 14.10 on a VPS I just set up yesterday. It seems as if I have two different Apaches installed at different places in the machine due to the following reasons.

  1. When I run sudo /usr/local/apache2/bin/apachectl start followed by ps -A I get this:

     4408 ?        00:00:00 httpd
     4409 ?        00:00:00 httpd
     4410 ?        00:00:00 httpd
     4411 ?        00:00:00 httpd
    

    It updates the error log /usr/local/apache2/logs/error_log with something like

    [Sat Feb 14 00:16:49.963014 2015] [mpm_event:notice] [pid 4542:tid 140160010012544] AH00489: Apache/2.4.12 (Unix) mod_wsgi/4.4.8 Python/2.7.8 configured -- resuming normal operations
    [Sat Feb 14 00:16:49.963260 2015] [core:notice] [pid 4542:tid 140160010012544] AH00094: Command line: '/usr/local/apache2/bin/httpd'
    

    as set by the configuration file found at usr/local/apache2/conf/httpd.conf

  2. However, if I run sudo apachectl start (after stopping the example in 1.) followed by ps -A I get this:

    4743 ?        00:00:00 apache2
    4744 ?        00:00:00 apache2
    4745 ?        00:00:00 apache2
    

    It updates the error log var/log/apache2/error.log with something like

    [Sat Feb 14 00:22:06.816281 2015] [mpm_event:notice] [pid 4743:tid 139905582937984] AH00489: Apache/2.4.10 (Ubuntu) configured -- resuming normal operations
    [Sat Feb 14 00:22:06.816480 2015] [core:notice] [pid 4743:tid 139905582937984] AH00094: Command line: '/usr/sbin/apache2'
    

    as set by the configuration file found at /etc/apache2/apache2.conf

I have been trying to set up a Django app with mod_wsgi and Apache, and in doing so have been editing the configuration file in example 1. I did a little googling and people seemed to be saying that apache2.conf and httpd.conf seem to compliment each other, but in my case, since they both set different ErrorLog information, and generally seem to control different programs, I'm a little confused.

Do I have two different Apaches instances installed on the same machine? Or is this just normal?


Yes, you have two Apache installations on your VPS.

You have Apache installed from the ubuntu repositories, installed in /usr You have Apache installed from source installed in /usr/local/apache2

Now, you stated in a comment that you tried to uninstall apache before reinstalling from source. It would appear that the uninstallation did not properly complete.

What to do about it...

Option A: Just use the apache from the repositories:

  1. Stop the apache you built from source. sudo /usr/local/sbin/apache2/apachectl stop.
  2. Just use the apache installed from the repos. Start it, or if its already running, restart it: sudo /etc/init.d/apache2 restart
  3. Unless you created init scripts when you built from source, you can safely ignore the installation from source - just don't start it manually again and you'll be fine.

Option B: Just use the apache you built from source

  1. Stop the repository provided apache. sudo /etc/init.d/apache2 stop
  2. Remove the apache from the repositories. sudo aptitude remove apache2
  3. Start (or restart) apache that you built. sudo /usr/local/apache2/bin/apachectl graceful

Yes - they are reporting different version numbers hence are different instances of Apache.

/usr/local/apache2 is the default base directory for a apache compiled from source, while the other one with files in /usr/sbin and /etc is the Ubuntu distributed version.

Unless you have a very specific reason for doing otherwise it is best practice to stick with the packages supplied by your distro. Updates will be managed via the package manager system and it should stay in sync with the rest of your OS.