CFMX Multi Instance Apache config - made simple
If the title makes sense then the rest of the article will be a breeze.
For some the hardest part of Apache is the fact that there is no GUI (Graphical User Interface) for the configuration. To me it's the reason I love apache! While it might be a bit daunting if you are new to Apache the power and flexibility that the text file configuration gives you is simply not feasible in an GUI.
At RedBalloon we have a number of different sites and a number of different servers so being able to manage the config files and lay them out to suit our needs it a huge boost. On top of this, we version our config files using subversion which gives us backups, rollback and a version history.
The windows installer sets up a basic and very well commented config which is a great base to start from. We typically add the following line at the end to allow simple loading of the virtual host config files:
Each vhost file consists of a number of related virtual host sections:
Listen 127.0.0.1:443
NameVirtualHost 127.0.0.1:80
NameVirtualHost 127.0.0.1:443
#Site 1
<VirtualHost 127.0.0.1:80> #HTTP
<-- removed for clarity -->
</VirtualHost>
<VirtualHost 127.0.0.1:443> # HTTPS
<-- removed for clarity -->
</VirtualHost>
#Site 2
<VirtualHost 127.0.0.1:80>
<-- removed for clarity -->
</VirtualHost>
<VirtualHost 127.0.0.1:443>
<-- removed for clarity -->
</VirtualHost>
We deliberately add listen directives at the top of the vhost file to easy migration of sites from one machine to another. All settings for a particular site are in one spot.
The sites in any one file are all related - i.e. for redballoon we have the main consumer site, our suppliers extranet site etc all in the one config.
The inner sections of the virtual host looks as follows:
Include conf/cfinstance/example1-instance.conf
DocumentRoot /path/to/wwwroot
ServerName www.example.com
Include conf/aliases/example1-aliases.conf
</VirtualHost>
<VirtualHost 127.0.0.1:443>
Include conf/cfinstance/example1-instance.conf
Include conf/ssl/example1-ssl.conf
DocumentRoot /path/to/wwwroot
ServerName www.example.com
Include conf/aliases/example1-aliases.conf
</VirtualHost>
By moving all of the common/repeated lines out to well named include files the vhost section is very simple to read and understand. It also makes it easy to add an alias across common sites or change the cfinstance the website is using.
Each of the include files is just the lines that would be directly in the file pulled out to an external file.
Eg - the cfinstance/example1-instance
# Bootstrap port is what specifies which instance to be used - see the JRun admin for the relevant numbers
JRunConfig Bootstrap 127.0.0.1:51020
JRunConfig Apialloc false
Gotchas
SSL certificates
If you are using SSL sites with name based virtual hosting there is a limitation which is: You can only have one SSL certificate - This works fine if all the sites are under the same domain - i.e. site1.example.com & site2.example.com and you have a wildcard certificate - *.example.com. The reason for this limitation is that when the server sends the SSL cert it doesn't yet know which domain you are looking for as it happens at the negotiation phase. Once the SSL cert is in use though the request proceeds correctly and serves the correct site.Wildcard sites - *.example.com
Apache supports the * operator for sites which mean any subdomain site will match this virtual host. With name based virtual hosting only the first site on a particular IP address will be able to do this. So it wouldn't work to have *.example1.com and *.example2.com on the same IP address. To get around this you need seperate IP addresses for each group of sites.

http://www.batteryfast.com/toshiba/portege-a100.ht... toshiba portege a100 battery,
http://www.batteryfast.com/toshiba/satellite-5100.... toshiba satellite 5100 battery,
http://www.batteryfast.com/toshiba/pa3128u.htm toshiba pa3128u battery,
http://www.batteryfast.com/toshiba/pa3191u.htm toshiba pa3191u battery,
http://www.batteryfast.com/toshiba/portege-4000.ht... toshiba portege 4000 battery,
http://www.batteryfast.com/toshiba/portege-m200.ht... toshiba portege m200 battery,
http://www.batteryfast.com/toshiba/portege-m205.ht... toshiba portege m205 battery,
http://www.batteryfast.com/toshiba/portege-m400.ht... toshiba portege m400 battery,
http://www.batteryfast.com/toshiba/pa3209u.htm toshiba pa3209u battery,
http://www.batteryfast.com/toshiba/satellite-1100.... toshiba satellite 1100 battery,
http://www.batteryfast.com/toshiba/satellite-1110.... toshiba satellite 1110 battery,
http://www.batteryfast.com/toshiba/pa3399u-1bas.ht... toshiba pa3399u-1bas battery,
http://www.batteryfast.com/toshiba/satellite-a100.... toshiba satellite a100 battery,
http://www.batteryfast.com/toshiba/satellite-a105.... toshiba satellite a105 battery,
http://www.batteryfast.com/toshiba/satellite-a80.h... toshiba satellite a80 battery,
http://www.batteryfast.com/toshiba/satellite-m100.... toshiba satellite m100 battery,
http://www.batteryfast.com/toshiba/satellite-m105.... toshiba satellite m105 battery,
http://www.batteryfast.com/toshiba/satellite-m110.... toshiba satellite m110 battery,
http://www.batteryfast.com/toshiba/satellite-m115.... toshiba satellite m115 battery,
http://www.batteryfast.com/toshiba/satellite-m40.h... toshiba satellite m40 battery,
http://www.batteryfast.com/toshiba/satellite-m45.h... toshiba satellite m45 battery,
http://www.batteryfast.com/toshiba/satellite-m50.h... toshiba satellite m50 battery,
http://www.batteryfast.com/toshiba/satellite-m55.h... toshiba satellite m55 battery,
http://www.batteryfast.com/toshiba/pa3356u.htm toshiba pa3356u battery,
http://www.batteryfast.com/toshiba/a50.htm toshiba a50 battery,
http://www.batteryfast.com/toshiba/a55.htm toshiba a55 battery,
the negotiation phase. Once the SSL cert is in use though the request proceeds correctly and serves the correct site.
http://www.wowgold800.com
http://www.wowgoldme.com
http://www.wowgoldvip.com
http://www.powerleveling365.com
http://www.wowgoldabc.com
http://www.goldwowgold.com
http://www.igwww.com
http://www.wowgoldchina.com
it's turning out to be pretty nice. anyways, just wanted to say thanks for sharing.I just started on my personal site (http://www.qxiu.net) using AJAXCFC along with the Flickr API,
http://usednissanpathfinder.blogspot.com/ used nissan pathfinder