Create Virtual host on EC2 (ubuntu)

Steps

  1. sudo mkdir -p /var/www/rex.com/
  2. sudo chown -R ubuntu:www-data /var/www/rex.com/
  3. sudo chmod -R 755 /var/www/
  4. cd /etc/apache2/sites-available/
    sudo cp 000-default.conf rex.com.conf
    sudo nano rex.com.conf
  5. sudo a2ensite rex.com.conf
  6. sudo service apache2 restart

Reference:

  1. http://diary.taskinghouse.com/posts/664386
  2. https://nouveauframework.org/blog/vhosts-running-multiple-sites-on-a-single-aws-ec2-instance/