Originally Posted by
boon4376
Could you also go into further detail on how I would use virtual hosts to accomplish this task?
Make a copy of /etc/apache2/sites-available/default, let's call it 'mysite'
Code:
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
Now you'll nee to edit the new file to point to your home directory. I've included a sample.
Code:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName mysite.example.com
DocumentRoot /home/username/mysite
<Directory /home/username/mysite/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/mysite/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/mysite/access.log combined
</VirtualHost>
Once you've saved these changes, you'll need to enable the site.
Code:
sudo a2ensite /etc/apache2/sites-available/mysite
Almost there. We've specified a separate directory for storing log files, so we'll need to create that.
Code:
sudo mkdir /var/log/apache2/mysite
Finally, we need to add the site to your hosts file. Edit /etc/hosts and add the following:
Code:
127.0.0.1 mysite.example.com
Now we restart Apache
Code:
sudo /etc/init.d/apache2 restart
You can now store all your work in /home/username/mysite and navigate to it by pointing your browser to http://mysite.example.com
Bookmarks