Multiple VirtualHosts

Here’s the proper way to host multiple websites (domains) on single host with a single IP address. Technically, you can have multiple Apache configuration files that you can enable within Apache, but you can easily simplify and combine them into a single Apache configuration file. You can separate each domain by creating multiple virtualhost sections as shown in the example below.

<VirtualHost *:80>
    DocumentRoot "/www/example1"
    ServerName www.example.com
    # Other directives here
</VirtualHost>
 
<VirtualHost *:80>
    DocumentRoot "/www/example2"
    ServerName www.example.org
    # Other directives here
</VirtualHost>

If you’re interested, read up on Apache’s website about virtual hosts.

Extend an EBS Volume

As a Cloud Engineer, I get a few requests to extend an EBS volume. For example, the application owner wants to double the size of the /data volume from 10GB to 20GB. The nice part about extending an EBS volume is that it can all be done on the fly without bringing down the instance. Adding more storage can be done via the AWS Console. Check out this article from AWS about modifying an EBS volume. But that’s just the first part. Although you’ve doubled the disk space, you still have to let the system know it now has doubled it’s disk space. The second part is to grow or resize the file system. Here’s the other article on how to extend a file system.

# expand
growpart /dev/xvdb
# for ext2, ext3 and ext4
resize2fs /dev/xvdb
# for xfs
xfs_growfs -d /dev/xvdb