Thanks for looking over the links and for your suggestions - you were totally right. I found the solution in this thread by cozman69.
Basically, this is what I did:
Code:
sudo mkdir /home/public_html
cd /home/public_html
sudo mkdir $USERNAME
sudo chown $USERNAME:$USERNAME $USERNAME
# copies the CONTENTS of ~/public_html to the dir we just created, following symlinks and preserving permissions
rsync -av public_html/ /home/public_html/$USERNAME/
cd ~
rm -rf public_html
# creates a symlink so that your experience will be the same
ln -s ../public_html/$USERNAME/ ./public_html
Then to set up apache userdir permissions:
Code:
sudo vim /etc/apache2/conf.d/userdir
Copy and paste, save and close:
Code:
UserDir /home/public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options Indexes SymLinksIfOwnerMatch IncludesNoExec
</Directory>
Then enable the userdir mod:
Code:
cd /etc/apache2/mods-enabled/
sudo ln -s ../mods-available/userdir.* .
sudo /etc/init.d/apache2 reload
Next, I created a Virtual Host for local dev that linked to the folder we created above:
Code:
cd /etc/apache2/sites-available/
sudo cp default ldev
# replace /var/www with /home/public_html/$USERNAME
sudo sed -i 's|var/www|home/public_html/'$USERNAME'|g' ldev
# enable the new virtual host
cd ../sites-enabled/
sudo ln -s ../sites-available/ldev ldev
sudo a2ensite ldev
sudo /etc/init.d/apache2 restart
# make your hosts file register the ldev TLD
# first backup the hosts file
sudo cp /etc/hosts ~/.hosts.bak
# append ldev to the localhost (::1) line for webkit browsers
sudo sed -i '/::1/s|$| ldev|' /etc/hosts
# append ldev to the 127.0.0.1 line for firefox
sudo sed -i '/127.0.0.1/s|$| ldev|' /etc/hosts
# now you should be able to see index.html at ldev
# first copy a sample document
sudo cp /var/www/index.html ~/public_html
# then open it in a browser
gnome-open http://ldev/
Bookmarks