Configuring Apache for per-user pages
In a previous post, I covered installing Apache 2.2.4 on Ubuntu. Unfortunately, if you want to create content for this server, you need to either use the root account, or change the permissions on the /usr/local/apache2/htdocs directory. Let's keep things that way.
First, open the Apache configuration file.
sudo nano /usr/local/apache2/conf/httpd.conf
Now find the following line, and remove the pound sign from the beginning of the line.
Ctrl + X to save and exit.
If you want, you can open this file by running the following.
sudo nano /usr/local/apache2/conf/extra/httpd-userdir.conf
But, there's no real reason to do this.
So, changes made, restart Apache.
sudo /usr/local/apache2/bin/apachectl restart
If you head over to http://localhost/, it'll still display the files in your htdocs folder (including the ColdFusion file, if you've got that created, and ColdFusion up and running).
However, you can now create a folder in your user directory and have direct access to your own content.
For example, if you have a bob user, you have a home directory at /home/bob/.
Create a public_html (the default setting, which can be changed in the above mentioned httpd-userdir.conf file). Now if you create files, you can access them by going to http://localhost/~bob/filename.ext
That's it, you're set. And yes, ColdFusion files will run (although it seems they run a tad bit slow ...).
Update, June 18, 2007 @ 21:11
Dan reminded me of no-ip, an account of which I had sitting around doing nothing. After messing around with it a bit, I've configured the "Dynamic Update Client." sudo make install (after extracting) sudo noip2 -C (all covered in the readme) Defaults all around. I haven't got this configured yet to start on startup. Dan, any good resources on this? Another good command, for a future reminder: sudo nmap -sV -O localhost to check which ports are open (80 and 631 on my machine); can't figure out how to close port 631 yet, or why I really need CUPS 1.2 (printing related, but I don't use a printer - I print to PDF if anything ...)
Update, June 18, 2007 @ 21:55
By the way, the Apache Phrasebook was helpful for easily setting these up (and is an overall great resource, if you're setting up / using Apache on Linux; the Windows information is there, but not as good as the Linux information).
Support This Site
If my blog was helpful to you, then please consider visiting my Amazon Wishlist.