Use your user’s public_html directory to serve webpages

Using a public_html file in your home directory is much more convenient than /var/www for a local website development environment. The following commands create a file called public_html in your home directory and enable the UserDir module in Apache.

From the command line, enter:

  • $ mkdir ~/public_html
  • $ cd /etc/apache2/mods-enabled
  • $ sudo ln -s ../mods-available/userdir.conf userdir.conf
  • $ sudo ln -s ../mods-available/userdir.load userdir.load
  • $ sudo service apache2 restart
This entry was posted in Musings and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Posted February 20 2011 at 11:30 pm | Permalink

    Nice info.

    A shorter option (Ubuntu and maybe all Debians):

    $ sudo a2enmod userdir
    $ sudo /etc/init.d/apache2 restart

    a2enmod handles all the necessary operations for mods enabling.

    Greetings.

  2. Posted February 21 2011 at 1:44 pm | Permalink

    Thanks Moises! So a2enmod does something besides just making a psuedo link eh? I admit I’ve never used it. I think its because when I was first trying to learn about virtual hosts it was really hard to understand. I didn’t grok it until I went full manual and did each step one at a time.

  3. Posted February 22 2011 at 2:26 pm | Permalink

    I checked out the a2enmod man page and it does just create the pseudo link. So its handy, but not vital.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>