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
3 Comments
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.
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.
I checked out the a2enmod man page and it does just create the pseudo link. So its handy, but not vital.