Configuring DNS - Web Servers with Subdomains

So I first purchased the domains phub.info and slabj.com for testing purposes. I changed the DNS settings to direct them to servers I created on DigitalOcean. I am connecting phub.info & slabj.com to LAMP stacks with Wordpress. The setup includes 3 main parts. Configuring GoDaddy where I purchased the domains to use custom 'Nameservers' such as ns1.digitalocean.com, ns2.digitalocean.com & ns3.digitalocean.com. 

Then I changed the A name record to @ 'hostname' to direct to the server I want to use and the CNAME of www to match the hostname of each site respectively so that people can visit my website by typing the site name or add a www to the front. The sites pointed fairly quickly but this process can take from 24-48 hours to take effect. I am going to add a subdomain to slabj.com so that if you goto promotions.slabj.com you can see special promotional offers for the month.

To add a subdomain within my Apache server configuration I goto /var/www where my html folder and wordpress folder are and I add in promotions as a folder. Within that folder I create a sample index.php file to test out the subdomain.



Then within the DigitalOcean DNS configurations I add in promotions as a new CNAME.
Then I add in the subdomain CNAME record. Next I configured the apache server site-available file. I made a copy of the default configuration and added in the specific routing needed for the subdomain. And then I enable the new test.com.conf file with 'sudo a2ensite test.com.conf'.


I now disable the original default configuration with 'sudo a2dissite 000-default.conf'. Now promotions.slabj.com brings up the content I had specifically put in the apache folder for promotions and I can add in special offers that are not on the main site with a specific subdomain.


Comments

Popular posts from this blog

Automated Exploitation of a Bluetooth vulnerability that leads to 0-click code execution

Sniffing GSM traffic on a private cellphone network

Raspberry Pi WiFi Honeypot 🍯