Copy link to clipboard
Copied
Hello,
I have several websites that I'm working on, and each one needs it's own development environment located on my own computer. At the moment my web root is located at: http://127.0.0.1:8500/. The problem is now that I have several subfolders underneath this web root, each one of them representing a separate website. I like referencing my images, stylesheets, javascript, and links as links that are relative the root URL, like this "/images/myimage.jpg". The problem is that now with multiple websites stored on my computer, the links don't point to my subfolders /company1, /company2, etc. Instead they point to the root itself, which doesn't work.
I was able to fix this by going into the following file and updating some code:
C:\ColdFusion11\cfusion\runtime\conf\server.xml
I uncommented this line of code and added the web root of my choice;
<Context path="/" docBase="<cf_home>\wwwroot" WorkDir="<cf_home>\runtime\conf\Catalina\localhost\tmp" ></Context>
This works great for just one of my websites. I can change the root here, and restart the server, and ColdFusion will point to the new root. However, what I really want to do is allow ColdFusion to have not just one virtual directory, but several. This way I won't have to change this code every time and restart the server.
Any ideas?
Thanks,
Pete
If you're running on Windows, you can use IIS to host multiple websites, and you can either connect ColdFusion to each website individually or to all websites globally.
-Carl V.
Copy link to clipboard
Copied
If you're running on Windows, you can use IIS to host multiple websites, and you can either connect ColdFusion to each website individually or to all websites globally.
-Carl V.
Copy link to clipboard
Copied
As Carl has pointed out, it's not the CF server that actually does the virtual hosting, it's the web server that you're using.
You can run IIS or Apache on Windows. I'm running an Ubuntu/Windows virtual development network, at home (two Ubuntu VM servers and a Windows VM server), I'm using Apache to create the virtual hosts, and I've changed the hosts file on the host system so that fake-FQDNs all point to the same IP address of my Apache server and let Apache do the work.
So, when I point a browser of the host system to "dev.rrp.com", Apache processes /home/rrp/public_html/root documents. When I point to "dev.nekojima.org", Apache processes /home/nekojima/public_html/root documents.
I'm not sure how to do it in IIS (I've never liked Microsoft), but I'm sure it's the same principle.
HTH,
^_^
Copy link to clipboard
Copied
Yes, IIS is similar. I usually create a root folder on my local hard drive for all my websites (like "C:\webdev") and put each distinct website in a subfolder under that. Alternatively, you can put put your websites inside C:\inetpub (the default IIS website will point to C:\inetpub\webroot). So your sites could be stored as C:\inetpub\site1, C:\inetpub\site2, etc. Then, in IIS Manager, you can create a separate website for each of those sites. As WolfShade mentioned, you can use a different hostname for each site (you set this in the Bindings section of each web site). You can then modify your local hosts config file (C:\Windows\System32\drivers\etc\hosts to have an entry for each of those hostnames, all pointing to 127.0.0.1.
-Carl V.
Copy link to clipboard
Copied
Thanks for the great info.
I'm wondering if I'll need to re-install CF in order to connect it to IIS.
Pete
Copy link to clipboard
Copied
No, just run the Web Server Configuration tool. It's in the ColdFusion program group under the Start menu.
-Carl V.