Run Multiple Instance Of Apache

Home » CentOS » Run Multiple Instance Of Apache
CentOS 10 Comments

Hello everybody,

I am trying to run 2 instances of apache on CentOS since 2 weeks with no lucks :S, exactly on the same IP address but different port. I’ve set up two configuration as follow:
/etc/httpd and /etc/httpd2, and I duplicated the httpd service, so now I have 2 httpd service each one run an httpd conf.

Now when I am trying to restart the first httpd service, it give the following httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName but the status is OK. And when I try to restart the httpd2 service, it give the same error with a failed status. Some internet research told that I have to put a serverName in httpd.conf (server name was commented) so I change it with the hostname of my VM.

Now when I try to restart httpd2 the error message disappear, but his status is always failed. N.B. My first httpd.conf don’t have a serverName. My /etc/hosts contain only:
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

Any help will be appreciated.

Thank you

Ahmad HC

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

10 thoughts on - Run Multiple Instance Of Apache

  • Why two services? To have 2 or more Webservers at the same maschine with one or several IPs, that’s why apache invented virtual hosts. Set up vhosts for every instance you want to run. See http://httpd.apache.org/docs/2.4/vhosts/examples.html

    Cu Hartmut

    This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

  • Thank you Hartmut, I’ve watched this link before but It’s not me who decide, in fact I work for a company and they want me to duplicate services to be able to start one and stop other or start both…so I don’t have choice I have to duplicate services, any suggestions

    —–Message d’origine—

  • Am Mon, 27 May 2013 08:15:52 +0000
    schrieb “HAJJ CHEHADE, Ahmad” :

    Try to follow this

    http://wiki.apache.org/httpd/RunningMultipleApacheInstances

    FreeBSD has support for this out of the box.

    You might want to take a look at how exactly FreeBSD handles the configuration. You will most likely also need to specify different log-, lock- and pid-files/paths.

    I’ve done it on FreeBSD and it works like a charm.

    Regards, Rainer

  • Apart from the FreeBSD solution from Rainer.

    Load balance? You could have several VM instances of apache front end. Depending on the traffic you could start/stop the VM instances.

    Also please do not top post.

    — Arun Khan

  • Am Mon, 27 May 2013 08:33:39 +0000
    schrieb “Woehrle Hartmut SBB CFF FFS (Extern)” :

    There are situations where you might want to do this. In our case, we had a customer running both mod_python and mod_wsgi at the same time on the same server. Due to some crashes, we decided to split apache up and add a 3rd proxy-instance on top of it. Has been running flawlessly since then.

    When your infrastructure is completely virtualized, it may make no sense. But some people still prefer to run on real hardware ;-)

  • Am Mon, 27 May 2013 14:16:45 +0300
    schrieb Mihamina Rakotomandimby :

    He doesn’t want to dig into lxc either, I assume. He just wants to run two apache-instances.
    ;-)
    And does CentOS come with lxc?
    I don’t think so…

  • One more problem the OP may have is with ssl.conf. It listens by default on port 443 and you can’t have both apache instances listening on that port, the second instance will refuse to start. He’ll need to change the port for one instance.

    Ran into this problem when I tried to run a separate instance of apache for BackupPC.

    Tony

  • ]

    RHEL6 has LXC as a tech preview right now so it’s theoretically feasible there …

    Of course the bigger challenge with multiple apache httpd instances is that you step outside the scope of what gets supported upstream – the RPM
    database would most likely no longer reflect the files to make a simple yum upgrade httpd possible…

    At that point you might as well roll your own in /usr/local and keep abreast of update notices to avoid security issues – like that seen only very recently…

    KVM though is sufficiently close to bare metal now that it is sane to use it for stuff like this to properly separate the instances with minimal performance loss overall with the added benefit that a compromise in one is unlikely to lead to a compromise in both…

LEAVE A COMMENT