Tag Archives: linux

Making public_html Work in Ubuntu 8.04 with Apache2

Ever wanted each user on your server to have their own web directory? I wanted users on my server to have access to the public_html directory in their home directory so that they could display content at http://www.mydomain.com/~USERNAME. How do you do this?

  1. Edit /etc/apache2/apache2.conf
  2. Find the section that looks like this:
  3. 1
    2
    3
    4
    5
    6
    7
    8
    
    #UserDir is now a module
    #UserDir public_html
    #UserDir disabled root
     
    #<Directory /home/*/public_html>
    #	AllowOverride FileInfo AuthConfig Limit
    #   Options Indexes SymLinksIfOwnerMatch IncludesNoExec
    #</Directory>
  4. Make it look like this:

    1
    2
    3
    4
    5
    6
    7
    8
    
    #UserDir is now a module
    UserDir public_html
    #UserDir disabled root
     
    <Directory /home/*/public_html>
    	AllowOverride FileInfo AuthConfig Limit
    	Options Indexes SymLinksIfOwnerMatch IncludesNoExec
    </Directory>

  5. Sit back and relish in your own glory knowing that you have just accomplished something done today!

How did I figure this out? Click here.

Password Protect a Directory in Apache 2

For anyone who wants to do this, the steps are as follows:

  • Edit /etc/apach2/sites-available/default
  • Look for the line "AllowOverride" in the section <Directory /var/www>
  • Change the line from "AllowOverride None" to "AllowOverride All"
  • Change to the directory you wish to password protect
  • Create a .htaccess file. The contents of mine is shown below. The only truly important line is AuthUserFile. This parameter should contain the path to the file containing your usernames/passwords. You should be able to figure out what everything else is on your own.
  • Create the .htpasswd file in the directory of your choosing with the following command:
1
sudo htpasswd -c /path/to/.htpasswd username

My .htaccess file:

1
2
3
4
5
6
7
AuthUserFile /var/www/path/to/site/.htpasswd
AuthName "Please Log In"
AuthGroupFile /dev/null
AuthType Basic
<Limit GET POST PUT>
    Require valid-user
<Limit>

VirtualBox

So, I am an avid Linux user (Ubuntu to be specific). I love the power and freedom that using Linux as an OS gives me. But one of my biggest gripes is that I still have to use some Windows stuff. For me that really means Microsoft Excel. I teach a Management Science class and am required to use Excel for modeling and solving optimization, simulation, and decision theory type problems. So for the longest time I've been dual booting Windows and Ubuntu. But I don't think that I'll have to anymore thanks to VirtualBox!

 VirtualBox, from their website, "is a family of powerful x86 virtualization products for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU Public License (GPL). See "About VirtualBox" for an introduction; see "InnoTek" for more about our company."

I am currently running VirtualBox on my Ubuntu Edgy system using Windows as a guest system. This allows me to use Ubuntu, use Excel/Word, and to go back and forth whenever I must. So what's the big deal? Why is this different from VMWare or QEMU? I'll tell you why - it's way faster! I don't know why, but it is! Solver runs faster! MS Visual Studio runs more quickly! And, while running the VM Ubuntu seems to run more quickly that it has with VMWare or QEMU.

I do have just a few suggestions though:

  1. Dynamic VDIs (Virtual Disk Images) are a bust. If you run out of space they barely expand at all (and I mean barely). I know this because I ran out of space while installing MS Visual Studio 2005. The disk didn't expand well or quickly enough. And to top that there is no way to simply expand a VDI or to copy and existing VDI to a new and larger VDI (at least now way that I was able to find. If there is a way someone please tell me!)
  2. Getting USB support to work is a pain. The mouse works fine, but I still can't access my flash drive. Hopefully this is my own fault and something silly like permissions or some such thing. But after following the manuals instructions for group ownership and permissions I have still not been able to get VirtualBox to access my flash drive.
  3. All of the features should eventually be accessible from the GUI. As of now there are quite a few features available only from the command line. I don't mind this, but it will save a lot of people headaches in the future.

So, overall VirtualBox is awesome! A few bugs to fix, a few features to add, but that's about all!