Olivia to Petra Bash: Recreating Apache Web Sites

We’ve come to the end of our Linux Mint Olivia to Petra party with a look at the bash script used to recreate our Apache Web Sites. Let’s first review what we covered in this upgrade series.

  1. We began with Backing Up Olivia. Here we used a script to backup our data and environment configuration files like our Cairo Dock settings, wallpaper, icons and so forth.
  2. With our files backed up and a pristine Petra OS up and running we covered Installing Apps and Desktop Configuration. Here we restored our files, re-applied the look and feel of our working environment, and installed the latest version of our applications.
  3. Since we’re a development shop, we next covered Installing the AMP in LAMP, where we installed Apache, MariaDB 10, PHP5 and other goodies like PHP MyAdmin, the Oracle 7 JDK/JRE and PostgreSQL.
  4. With MariaDB installed, next came Restoring MySQL Databases.
  5. In today’s series conclusion we will be using a bash script to recreate our Apache web sites.

We’re going to copy our Apache Site Configuration files from a extracted tar file folder to /etc/apache2/sites-available. We will enable each site when its site-available file is created, then when all sites are enabled we will restart the apache2 web service. Along the way we will enable a couple of Apache Modules needed to support Tomcat virtual sites.

The backed-up site configuration file directory we’ll be using to copy and create our Apache sites looks like this.

Our bash script logic is pretty simple, but it will still be able to do the job with a single click (or single command to be precise.)

  1. Our create_site() function copies the file and enables the site in Apache
  2. We loop through each of the files in our storage folder and feed them to our create_site() function.
  3. Tomcat virtual sites require the addition of a couple of proxy Apache Modules, so we’ll add those here and restart Apache Web Services.

Here is a link to the script tar.gz. You know by now in the series that you’re on your own and are fully responsible for any unforeseen results from using this or any NixMash script.

That’s our show! The Linux Mint Olivia to Petra bash comes to a close. I hope we helped you simplify your upgrade process and more fully enjoy the most excellent computing environment we know as Linux Mint.