If you have two separate virtual personal servers running Ubuntu or any other edition of Linux, it’s easy to configure the machines to serve content for other subdomains in the same primary domain.First, create DNS entries for each of the subdomains.IN THE DNS record of the primary domain. Then, use the Apache virtual server to configure subdomains on each of the VPSs.
Connect to the domain registrar account where the primary domain is registered.Change the DNS entries for the domain. Create a host record for the first subdomain and assign the IP address of the first VPS.Do the same for the time of the subdomain.
Connect to the first VPS and create a new Apache virtual host configuration record in the default virtual host logs directory, “/etc/apache2/sites-available.”Name the record in the same way as your subdomain.Use the “sudo” to edit the registry as root user and use the nano text editor that is with Ubuntu.For example, to create and open the nano type record:
sudo nano / / apache2 / sites-available / subdomain1
Create a new VirtualHost example in the configuration log by entering the VirtualHost opening and final tags and specifying the IP address of the subdomain.Enter the remaining VirtualHost settings between the opening and ending tags.For example, type:
Configure the server for the subdomain. Assign the root user as a server administrator, configure the server call to the full domain call of the subdomain, and specify the location of the program files in the subdomain, for example, between the VirtualHost opening and ending tags:
ServerAdmin root – localhost ServerName subdomain1.parentdomain.com DocumentRoot / var / www / subdomain1 / html
Create log registration regulations for the subdomain by opting for the default “warn” registration point and offering log locations to log errors and visits.For example, type the following between the VirtualHost opening and ending tags:
Loglevel warn LogFile /var/log/apache2/subdomain1-error.log CustomLog /var/log/apache2/subdomain-access.log
Save the log by tapping “Ctrl-X” to save, “Y” to verify the backup and “Input” to settle for the registry name.
Run the “a2ensite” command to power on the created virtual host and use “sudo” to run the command with root privileges.Turn on the newly activated site, again with the “root” privileges, asking Apache to reload all virtual hosts. For example, type:
sudo a2ensite subdomain1 sudo /etc/init.d/apache2 force-reload
Repeat the same procedure for the currently subdomain on the other VPS.Test the settings by going to the subdomain in a browser and examining the results.
Steve McDonnell’s delight in business control and business outreach complements his technical expertise in information, generation, and human resources.He graduated from Dartmouth College with a bachelor’s degree in computer science, served on the editorial board of WorldatWork, on the Spotfire Business Intelligence blog blog, and e-books and e-book chapters published for International Human Resource Information Management and Westlaw.