Multiple apache instances in one rhel server?

Latest response

I searched the KB for this info and could not find the answer.

 

What is the best way to host more than one apache httpd instance in rhel 5/6 ?

 

I do not mean run many sites under one apache config. I mean having 2 or more sites running as separate apache instances so I can work on one instance (or site) without affecting the other.

 

Thanks in advance

Responses

The "best way" will be determined by your hosting needs and the resources you have available.

 

If you're simply wanting to post up multiple web-sites on one server, then you can use name-based virtual hosts. These use a shared IP address running under a single instance of Apache

 

If you want each site you're hosting to have it's own IP address, you can run one Apache instance configured to listen for each site at a unique IP address or you can set up multiple Apache instances, each listening to one IP address. The latter is more resource intensive, but, if you're reselling services, allows each subscriber to fully control their own Apache configuration. It also allows you to run different Apache versions and module loads.

 

Overall, you can accomplish the goal of being able to modify one site without impacting others through either the single-instance or discrete instance model.

 

Basically, to provide you the "best" answer, we need more information about what you're trying to accomplish and what technical goals you need and want to achieve.

Just wanted to touch on Thomas' excellent comments earlier. You have three options in total:

  1. Use name-based virtual hosts (HTTP/1.1 virtual hosting) for multiple virtual hosts in the same instance
  2. Use IP based virtual hosting for multiple virtual hosts in the same instance
  3. Run multiple instances with different configroots

If you are looking for total and complete segregation between web sites, #3 is your choice.

If you select option #3, you'll want to modify the httpd start script to start multiple instances with different configurations. Look at the following two httpd command-line options for additional detail.

-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile

Running multiple instances of apache may create problems with Red Hat support. If you face any issues with Apache, support team may request you to reproduce the issue with a single instance of apache.

 

As noted earlier, the "-d directory" will do the trick and you need to modify the init script appropriately.

 

On the other hand you can run two virtual machines on this host and run individual apache instance on those two virtual machines which could provide more isolation and an easy way for management.