This is the “document root” for the site. The default site is, of course, /var/www/html. This new site can be pretty much anywhere, but I’ve been keeping them in that /var/www structure.
For the sake of this document, I’ll call it /var/www/newsite. Populate it with files for the site (index.html, etc.), set permissions (if it should not inherit the permissions of its parent directory), etc.
Presumably, the host (we’ll call it webserver.mydomain.com) already has an A record. For the new site, a CNAME record pointing to that server will need to be created. For this document, the CNAME host will be newsite; the new URL, newsite.mydomain.com.
This is the file that tells Apache about the new site.
ServerAdmin newsiteadmin@mydomain.comServerName mydomain.comServerAlias mysite.mydomain.comDocumentRoot /var/www/newsiteWhen all is said and done, the newsite.conf file will look like.
<VirtualHost *:80>
ServerAdmin newsiteadmin@mydomain.com
ServerName mydomain.com
ServerAlias mysite.mydomain.com
DocumentRoot /var/www/newsite
ErrorLog ${APACHELOGDIR}/error.log
CustomLog ${APACHELOG_DIR}/access.log combined
</VirtualHost>
This is pretty straight forward.
a2ensite sudo a2ensite newsite.confsudo service apache2 restart