private static void generateApacheConfigFile(String apacheLocation, String domain) throws IOException {
		if(!apacheLocation.endsWith(File.separator))
			apacheLocation = apacheLocation + File.separator;
		if(!ftpFolder.endsWith(File.separator))
			ftpFolder = ftpFolder + File.separator;

		Site site = sites.getSite(domain);

		StringBuffer out = new StringBuffer();
		out.append("#\n");
		out.append("# DO NOT EDIT THIS FILE. It is automatically generated\n");
		out.append("#\n");
		out.append("<VirtualHost *:80>\n");
		if(!domain.startsWith("www.")) {
			out.append("    ServerName "+domain+"\n");
			out.append("    ServerAlias www."+domain+"\n");
		} else if(domain.startsWith("www.")) {
			out.append("    ServerName "+domain.substring(4)+"\n");
			out.append("    ServerAlias "+domain+"\n");
		}
		for(String alias : site.getAliases()) {
			out.append("    ServerAlias "+alias+"\n");
		}
		out.append("    DocumentRoot " + ftpFolder + domain + "\n");
		out.append("    ServerAdmin it-help@unimelb.edu.au" + "\n");
		if(domain.startsWith("www.")) {
			out.append("    CustomLog \"|/usr/sbin/rotatelogs -l /var/log/httpd/"+domain.substring(4)+"-access.%Y%m%d%H%M%S.log 3600\" common" + "\n");
			out.append("    ErrorLog logs/"+domain.substring(4)+"-error_log" + "\n");
		} else {
			out.append("    CustomLog \"|/usr/sbin/rotatelogs -l /var/log/httpd/"+domain+"-access.%Y%m%d%H%M%S.log 3600\" common" + "\n");
			out.append("    ErrorLog logs/"+domain+"-error_log" + "\n");
		}
		out.append("    ScriptAlias /cgi-bin/ /servers/http/cgi-bin/\n");
		out.append("</VirtualHost>" + "\n");

		boolean updated = updateFile(apacheLocation, domain, out.toString());
		if(updated) apacheRestartRequired = true;
	}