Apache can be configured to connect to an instance of JRun at the global level and/or at the Virtual Host level. If configured at the global level, any Virtual Hosts will inherit the ability to connect to the globally-defined JRun server, and any JRun settings in the Virtual Host directive can override that of Apache's global level. If all the Virtual Hosts use the same JRun server as defined at the global level, then they will be configured for the same Serverstore and Bootstrap. In this way you can configure Apache for ColdFusion/JRun in a many to one relationship.

However, you can also configure a Virtual Host for a different JRun instance to achieve a one to one relationship for each Virtual Host. To do this, first set up a jrunserver.store for the second instance by copying {jrun_home}/lib/wsconfig/1/jrunserver.store, then create a directory {jrun_home}/lib/wsconfig/2/ and paste the jrunserver.store copy there. Edit {jrun_home}/lib/wsconfig/2/jrunserver.store to list the host:proxyport for the second instance, noting that the proxy port for that instance can be obtained from either the JMC or jrun.xml. Finally, edit the Virtual Host directive in httpd.conf, and add the following (where JRun's home is /opt/jrun4/ and the JRun server:proxy port is in the example):

JRunConfig Serverstore /opt/jrun4/lib/wsconfig/2/jrunserver.store
JRunConfig Bootstrap
JRunConfig Apialloc false

The JRunConfig Apialloc setting must be set in the Virtual Host for second instance, and must be set to false.

If not, one in every 4 or 5 requests will return an Apache Internal Server Error to the client with a 500 status code and the Apache error log will record a message such as:
[Thu Jun 24 15:09:33 2004] [notice] jrApache[1635] JRun will not accept request. Check JRun web server configuration and JRun mappings on JRun server.

Here is an example httpd.conf file from Apache 2.0.47 configured for the first ColdFusion instance on JRun at the global level, configured by default for the same ColdFusion instance on the first Virtual Host, and configured for a second ColdFusion instance in the second Virtual Host. Note that JRunConfig Apialloc false is set at the global level and in the second Virtual Host.

The JRun connector setting for Apialloc governs from where the connector allocates memory. The connector stub is written in C and when it needs to allocate memory it can either ask the operating system for memory (apialloc=false) or ask Apache for it (apialloc=true). Asking Apache for memory was probably quite safe in Apache 1.3x with just one instance of a JRun server, but its best to always set apialloc to false and let the stub work with the OS to manage memory.