The ACME Guide: 64-bit Ubuntu 8.04 LTS Hardy Heron Edition - Part 5
Now that our ACME stack has been installed, let's setup some isolated development areas. To do this, we need to create one or more Virtual Hosts in Apache and setup some local domains.
Apache Virtual Hosts
In part 1, we talked about how Apache sets up the localhost domain pointed to files in /var/www/. This is why http://127.0.0.1/ displays It works! (index.html) when you first visited it and why it should display the current date and time (index.cfm) when you go there now.
Rather than run all of your projects under the same root folder and under the localhost domain, it's often a good idea to create a local domain and separate root folder for each project.
http://dev.acme.localhost
Rather than place project files under /var/www/, I often place them under my home directory or in a folder on another disk or partition.
1. Create a new root web directory.
I'm going to create a new directory at the system's root level. This will contain files for all of my projects. You'll have to use sudo to create the folder as the root user.
[sudo] password for amoreno:
amoreno@amoreno-desktop:/$
amoreno@amoreno-desktop:/$ ls -l
drwxr-xr-x 2 root root 4096 2008-06-24 23:22 webroot
Now we need to change the owner of the folder to that of your user account.
amoreno@amoreno-desktop:/$ ls -l
drwxr-xr-x 4 amoreno amoreno 4096 2008-06-24 23:22 webroot
Now we can enter this folder under your normal user account and create files and folders without having to use sudo. Let's create a folder for an ACME website:
Create a default page:
2. Create a new Virtual Host entry.
Now we need to let Apache know how to find the files for the ACME website. For that, we need to go to the Apache folder.
amoreno@amoreno-desktop:/etc/apache2$ ls -l
total 52
-rw-r--r-- 1 root root 10587 2008-05-14 02:58 apache2.conf
drwxr-xr-x 2 root root 4096 2008-06-12 23:14 conf.d
-rw-r--r-- 1 root root 378 2008-05-14 02:58 envvars
-rw-r--r-- 1 root root 904 2008-06-06 01:54 httpd.conf
-rw-r--r-- 1 root root 0 2008-06-06 01:54 httpd.conf.1
drwxr-xr-x 2 root root 12288 2008-06-12 23:14 mods-available
drwxr-xr-x 2 root root 4096 2008-06-03 00:03 mods-enabled
-rw-r--r-- 1 root root 59 2008-05-14 02:58 ports.conf
drwxr-xr-x 2 root root 4096 2008-06-24 22:47 sites-available
drwxr-xr-x 2 root root 4096 2008-06-24 22:52 sites-enabled
amoreno@amoreno-desktop:/etc/apache2$
Let's go into the sites-available folder and open the default website configuration file.
Actually, let's create a copy so that we don't lose the default settings.
total 4
-rw-r--r-- 1 root root 985 2008-05-14 02:58 default
amoreno@amoreno-desktop:/etc/apache2/sites-available$ sudo cp default acme
amoreno@amoreno-desktop:/etc/apache2/sites-available$ ls -l
total 8
-rw-r--r-- 1 root root 985 2008-06-25 00:04 acme
-rw-r--r-- 1 root root 985 2008-05-14 02:58 default
To make things easy, open the acme file in gedit. Notice that the file is owned by the root user.
[sudo] password for amoreno:
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
In the normal distribution of Apache, these settings would be broken up across a few files. The version that is maintained in the Synaptic Package Manager keeps them all in one file, so copying and making changes will be very easy.
A "#" before any line marks a comment.
1. Add a ServerName
ServerName dev.acme.localhost
ServerAdmin webmaster@localhost
2. Change the DocumentRoot
3. Give Apache permission to access the new folder you created.
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
4. Change the Error Log.
5. Change the CustomLog.
6. Optional: Create an alias to /CFIDE and other folders.
7. Save the file and exit the editor.
3. Create a new link in sites-enabled.
We just edited the acme file in the sites-available folder. Apache only loads Virtual Host configurations in the sites-enabled folder.
total 8
-rw-r--r-- 1 root root 985 2008-06-25 00:04 acme
-rw-r--r-- 1 root root 985 2008-05-14 02:58 default
amoreno@amoreno-desktop:/etc/apache2/sites-available$ cd ../sites-enabled/
amoreno@amoreno-desktop:/etc/apache2/sites-enabled$ ls -l
total 0
lrwxrwxrwx 1 root root 36 2008-06-03 00:03 000-default -> /etc/apache2/sites-available/default
amoreno@amoreno-desktop:/etc/apache2/sites-enabled$
In the sites-enabled folder, you can see that there is a link to the default Virtual Host file. Let's create one for acme.
[sudo] password for amoreno:
amoreno@amoreno-desktop:/etc/apache2/sites-enabled$ ls -l
total 0
lrwxrwxrwx 1 root root 36 2008-06-03 00:03 000-default -> /etc/apache2/sites-available/default
lrwxrwxrwx 1 root root 23 2008-06-25 00:18 acme -> ../sites-available/acme
amoreno@amoreno-desktop:/etc/apache2/sites-enabled$
4. Restart Apache
Apache has to be restarted to load the new Virtual Host configurations.
5. Create a new hosts entry.
Every OS has a file that acts like a local Domain Name Server. Open it and add the ServerName you created in the acme file, pointing to 127.0.0.1.
127.0.1.1 amoreno-desktop
127.0.0.1 dev.acme.localhost
Save and exit gedit.
6. Open the URL in a browser.
You should now be able to enter http://dev.acme.localhost into your browser and see the output from /webroot/iknowkungfoo/acme/index.cfm.
{ts '2008-06-25 00:34:28'}
That's it for now
Your 64-bit Ubuntu ColdFusion development environment is now up and running at full steam. If you have any questions or if you'd like to see something else added to this version of The ACME Guide, let me know in the Comments or through my Contact form.
Now that I've got my own ACME setup running, I can get back to the CF + OOP Primer and get some work done on that book I'm supposed to be writing. :)








Thanks for putting these ACME guides together. I upgraded from Vista to Ubuntu (and then to Mint for its admin tools & aesthetics) a few months back, but hadn't really setup any local dev stuff other than Eclipse. This guide made it pretty easy to get up and running with a full local dev environment in just a short amount of time.
If you've got any tips on making VNC as fast as (or faster than) RDP, I'd love to hear them. In the meantime, I look into setting up an RDP server on Mint.
I think just about the only thing I would add to this is to remove the 'NameVirtualHost *' directive at the top of the new configuration file. Else apache throws an error.
How do we start-up ColdFusion as a service?
Thanks for your help
Anyway, thanks for a great How-To!!
http://www.kisdigital.com/index.cfm/2008/11/13/Sta...
127.0.0.1 mysite
With this setup at least now I get a CF error. When I load http://mysite/ in a browser I get the following CF error:
Could not find the ColdFusion Component or Interface mysite.cfc.shoppingCart
Please assist.
Thanks