EASY STEPS FOR CREATING SUB DOMAIN WITHOUT CPANEL IN VPS SERVER

Hi all !

Creating sub domains in cPanel is much easier even for non techincal user. But in this article we are going to see how to create sub domains without cPanel in VPS server.

Step 1:

Connect your VPS Server using putty (SSH service). In the host name filed you need to enter your server’s IP address.SSH default port number is 22. In case If you changed the SSH port number, then give the appropriate number and then click open.

Step2:

Then the login prompt open, here you need to give your user name & password.

Step 3:

Once you connected with your server, open the file appache configuration file using any editor like nano, vi etc.

# nano /etc/httpd/conf/httpd.conf

Note : In this case appache is already installed on your server.

Step 4:

Go to the end of the file and add the below lines to create the virtualhost for subdomain.

<VirtualHost *:80>

ServerAdmin webmaster@tnadu.com DocumentRoot “Your subdomain path” ServerName “Your subdomain name” ServerAlias “Your server alias name” ErrorLog “Apache error log file” CustomLog “Log file”

</VirtualHost>

Step 5:

Add the A record for the subdomain at the end of the file by opening the DNS configuration file using the command :

nano /var/named/yourdomainname.com.zone

Note : In this case bind is already installed on your server.

STEP 6:

Then you need create a directory for your sub domain & log files as early you mentioned in your httpd.conf file.

# mkdir /Your subdomain directory

Inside your subdomain direcorty you can upload your contents that can viewed through browser while accessing your subdomain.

For EX : Create a indext.html folder inside your subdomain path and the add the below contenst.

<html>

<head> <title>www.sub.yourdomain.com</title> </head> <body> <h1>Success: You Have Set Up a Subdomain</h1> </body> </html>

Step 7:

Restart the httpd service and named service after updating the details by using the below commands :

# service httpd restart

# service named restart

About

View all posts by

Leave a Reply

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