Friday, June 12, 2015

How To Create Sub-Domain in Virtualmin

Hello again, now i'm gonna show you how to "Create Sub-Domain in Virtualmin" in this tutorial i will install roundcube and add sub-domain pointing to roundcube. Roundcube is a web-based email client. In previous post, i have explain how to create sub-server in Virtualmin (How To Create Sub-Server Virtualmin), Sub-Domain and Sub-Server are diffrent, and the way to create it is diffrent.


Before we want to create Sub-Domain or Sub-Server, we must know what is the diffrent, how do they act, and the structure in directory.
Let's take an example : forum.angelimusvps.tk, let see the structure both Sub-Domain and Sub-Server, see below.

Sub-Server directory of forum.angelimusvps.tk
/root/home/angelimusvps.tk/domains/forum.angelimusvps.tk/public_html/<website files>

Sub-Domain directory of forum.angelimusvps.tk
/root/home/angelimusvps.tk/public_html/forum/<website files>

Okay, lets start create Sub-Domain.

Step 1 - Install Roundcube 
(you can skip this step if you already have directory for sub-domain destination directory)
1. Open your browser, and login to your terminal.
2. Choose your domain that you want to install roundcube on left panel, by click the drop down menu.
3. Click Install Script on left panel, and see on the right panel, in email section, click on roundcube
4. Click on Play Button on the Right or Simple Just Click "Show Install Options"
5. I'm gonna use my domain in this case angelimusvps.com, so my "Database for RoundCube preferences" = angelimusvps_tk_roundcube (MySQL, new database)
6. Install sub-directory under public_html = DO NOT CHOOSE at top level, and type roundcube, by default its checked beside that.
7. Click "Install Now"

Note :
(1)For someone of you that running Centos 6, maybe have a little problem in PHP Version, in my case, i can't install roundcube, because my PHP Version is 5.3.3 so i must upgrade into PHP 5.4.x, see this tutorial to upgrade your php How To Upgrade PHP 5.3 to 5.4 in Centos 6

(2)After installing roundcube, now try open your browser and type http://<yourdomain>/roundcube if nothing  happened, or it's like downloading or saving something else, maybe thats normal, because i have same problem like that before, now go to virtualmin again, on left panel > angelimusvps.tk (as domain) > Server Configuration > Website Option > PHP script execution mode = Apache mod_php (run as Apache's user) 

Click save, now try again open your roundcube http://<yourdomain>/roundcube

Step 2 - Create Sub-Domain 
Now i'm gonna make subdomain inbox.angelimusvps.tk that point to /home/angelimusvps.tk/public_html/roundcube

1. Manage your domain in your domain provider.
My domain is free domain from freenom.com, so i login to freenom.com and manage  freenom domain, add new record inbox A (your ip) see image below
after that click on save changes, wait about 10-30 minutes, i usually only wait about 10 minutes.
to check if it already registered, try ping inbox.<yourdomain>.tk if no reply or time out, wait again a few minutes and ping again. If you still confuse about this manage dns, see my previous tutorial in ()

2. Go to Virtualmin, on left panel, on top section, click on Webmin
3. Click Servers > Apache Webserver, now see on right panel, click on "Create Virtual Host

1. Choose "Spesific address" = your vps ip address
2. "Document Root" = find your directory that you want to redirect to subdomain.
3. "Server Name" = just type your subdomain, i type inbox.angelimusvps.tk
Click "Create Now"

Note : after you click create now, see on top right section, Click "Apply Changes", then "Stop Apache", then "Start Apache"

Open your browser, and type your subdomain, ex : http://inbox.angelimusvps.tk you will see your sub directory redirected to sub-domain.

I think that's it for now, if your have a better and simple and more secure, feel free to share on comment section, and see you in next tutorial.

2 comments:

  1. Thank you so much for supplying us with a step-by step guide. It's a well-written and clearly described post to grasp the necessary information from!

    ReplyDelete

  2. Very quickly this website will be famous among all blogging people, due to it's pleasant articles or reviews capitalone com login

    ReplyDelete