Create an interactive script to add subdomain to apache2 on Ubuntu Server

In a previous tutorial, I showed how to create a subdomain on your Ubuntu Server running Apache. Today I’m going one step further and I’m going to create a script that’ll automatically create a new subdomain.

You can find a previous tutorial on scripting on this page. And for the tutorial on subdomains, visit this page.

To get started, I’m first going to create the file that’ll hold our script. I’ll create the file in my user’s home directory.

In the file add the following line to make it executable:

Below that I’ll add the following code:

 

To run the script, type  bash createSubDomain.sh.

Untitled

Leave a Reply

Your email address will not be published. Required fields are marked *

Protected with IP Blacklist CloudIP Blacklist Cloud