In order to enable the user-specific public_html directory open up a terminal and switch to the apache module config directory:
cd /etc/apache2/mods-enabled
If you list all the files inside this directory you’ll notice that all of them are actually symbolic links. To enable mod_userdir, which is the module you’re interested in, you’ll have to create two symlinks to the relevant files:
sudo ln -s ../mods-available/userdir.load
sudo ln -s ../mods-available/userdir.conf
All done! Now restart Apache via:
sudo apache2ctl restart
We can now access the web applications stored in our /home/username/public_html directory via http://localhost/~username/
Advertisements
Aug 19, 2008 at 5:07 am
love u man!
😀
Aug 30, 2008 at 1:43 am
This page solved my problem. Thanks a lot! Hugs and kisses from Sweden 🙂
Dec 5, 2008 at 10:24 pm
Thank you so much – took me 10 seconds to find your site and about a minute to enable this.
Jan 30, 2009 at 4:19 pm
Thanks
keep it up
Feb 11, 2009 at 9:59 pm
Thanks Heriman, just to add up and make it even easier, for the 2nd step, use instead the Apache command that comes with Debian based distros, which creates the symlink:
#a2enmod userdir
Cheers and thanks for sharing 😉
Feb 12, 2009 at 1:10 am
Thanks, this worked exactly as you wrote it, I was concerned about what permissions to give the public_html folder in my user home directory, and defaults worked fine.
Logged in as myself, I created a folder called “public_html” with the mkdir command.
Thanks,
Ken
Mar 3, 2009 at 5:44 pm
Hello webmaster
I would like to share with you a link to your site
write me here preonrelt@mail.ru
Apr 28, 2009 at 8:18 am
wowww…
Thanks a lot dude..
May 7, 2009 at 8:22 am
simple, clean and functional. Thanks!
Jul 24, 2009 at 9:58 am
thanks a lot. truly clear!!!
Oct 10, 2009 at 1:47 am
This tip was Fantastic… congragulations!!!
Apr 6, 2011 at 2:50 am
Very useful! thank you very much!
Jul 24, 2012 at 1:16 am
The statement, afet adding the symbolik links:
————————————————————
We can now access the web applications stored in your
/home/username/public_html directory via http://localhost/~username/
seems rather trivial in its usage. Based on the syntax shown:
e.g. http://localhost/bimbo/ should have presented me with an index.html page within /home/bimbo/public_html directory.
Instead it barfs with a message:
The requested URL wa snot found on this server.
I’m sure there are a few more steps missing before we can start using the above URL. Yes! The procedure shown above worked fine, but does not help me access index.html within user specific directory as simplified in this message.
Will continue Googling to get the complete the required procedural steps.
Yaj
Aug 6, 2012 at 4:01 pm
Thanks!!!
Oct 19, 2012 at 11:32 pm
Ya, thanks!
May 29, 2013 at 10:36 pm
“Thanks for spending the time to discuss this, I feel strongly about it and love reading more on this topic.”
Jun 28, 2013 at 12:50 pm
Thanks, worked like charm.
Nov 9, 2013 at 10:14 pm
Thanks.
To enable PHP for user dirs edit /etc/apache2/mods-enabled/php5.conf
Nov 11, 2013 at 1:04 pm
Great article, but I have tried in some differenet way
sudo a2enmod userdir
sudo /etc/init.d/apache2 restart
Give the following permission to public_html directory-
chmod -R 755 ~/public_html
Now access it from web browser-
http://localhost/~username/
Source: http://stackoverflow.com/questions/526742/how-can-i-make-a-public-html-folder-in-ubuntu
Apr 10, 2015 at 1:08 am
I’d like to live on Kauai. It was small, quiet, and it had lots of opportunities for an adventure.