sudo mkdir -p /root/public/example.com
sudo mkdir -p /root/public/example.com/backup
sudo mkdir -p /root/public/example.com/log
sudo mkdir -p /root/public/example.com/public
sudo chmod -R g+rwxs /root/public/example.com/public
sudo touch /etc/apache2/sites-available/example.com
sudo chown -R user:group /root/public/example.com/
sudo nano /etc/apache2/sites-available/example.com
Copy and paste (obviously update the details)...
# domain: example.com
# public: /roots/public/example.com/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName www.example.com
ServerAlias example.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /root/public/example.com/public
# Log file locations
LogLevel warn
ErrorLog /root/public/example.com/log/error.log
CustomLog /root/public/example.com/log/access.log combined
</VirtualHost>
sudo a2ensite example.com
sudo service apache2 restart
Also check out how to remove an unwanted domain/subdomain from Linode here