Over the weekend, I’ve spent a substantial chunk of time figuring out how to add a virtual host onto a client’s subdomain. In laymen’s terms, this means that:
- My client has a website hosted on a domain (which we shall call example.com, for confidentiality reasons)
- We want to build a web application on app.example.com, which will be entirely separate from example.com.
- To save on cost, we want to host app.example.com on the same server that example.com is using (i.e. create a virtual host on the web server).
This means that we have to configure our web server so that it will serve a different webroot depending on the domain it is being accessed from.
If you manage a Unix-like server, every now and then, you might get an email from the server notifying you of important errors that occur in your server. Here’s one that I got earlier today from an Ubuntu 18.04 server of mine:
Cron <root@terresquall> test -x /usr/sbin/anacron || ( cd / && run-parts –report /etc/cron.daily )
/etc/cron.daily/logrotate:Mail sent at 06:39
error: error running shared postrotate script for ‘/var/log/apache2/*.log ‘
run-parts: /etc/cron.daily/logrotate exited with return code 1
It’s never fun to receive server admin emails like this, because it means that your server has issues, but the message tends to be really ambiguous, so it’s really hard to figure out what the issue is. Obviously, I didn’t know what the issues were, so I had to do some research.