Multiple Sites on Multiple Hostnames

Example to setup 2 hosts

Setup Virtual Host

  1. www - http://www.example.com
  2. docs - http://docs.example.com

Setup docs

Edit a docs.conf in /etc/apache2/sites-available

vim /etc/apache2/sites-available/docs.conf

Example:

<VirtualHost *:80>
    
    ServerName docs.example.com
    
    ServerAdmin webmaster@localhost
    
    # The root document
    DocumentRoot /var/www/docs  
    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>