Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I know I can do this to set up a www directory from my home folder

gksu gedit /etc/apache2/sites-enabled/000-default

replace /var/www with /home/myusername/www

sudo service apache2 restart

But is there a way to use /home/$USER/www?

I don't want to use localhost/~myusername because it will mess up my code.

Basically I want to be able to login into different accounts on my laptop - one for work one personal - but have localhost default to the current logged in account.

Thanks, Russ

share|improve this question
add comment

2 Answers

No, you cannot do that. Apache is a system-wide web server, and Ubuntu is a multi-user system. Multiple users can be "logged in" at the same time, and Apache doesn't know anything about them.

You can however, simply set up multiple sites running on different ports, that point to different DocumentRoot directories on the machine.

share|improve this answer
add comment

You may be able to set an Environment Variable in the .bashrc script for each user, and then have the 000-default vhost access that environment variable. You'd have to restart /reload apache everytime you log in, but it might work. See This Answer for a little more information.

A simpler solution may be to set up more virtual hosts (use 000-default as a starting point) and edit your /etc/hosts file for local dns resolution.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.