-1

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

2 Answers 2

0

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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