Host website on Linux without Control Panel

2
71

Today we are going to discuss about hosting a website on CentOS Server.

First of all you need to purchase a domain from Gen X Web Hosting, and then you need to update an A record of your Domain as that of Server IP.

Steps to Update A Record

1. Login to client area using http://genxwhosting.com/clientarea.php

2. Select the Domain in which you want to update DNS.

3. Click on DNS Management.

4. Add  A Records and CNAME Records and other records that you need to update by selecting the type of record in from the drop down menu:

5. Click On Save Changes to Add records.

Configure Apache to make your website live  on Internet

Once IP is added in your Domain Panel.Fallow the Steps given below

1. Login in your Server via SSH and Install Apache Server.

yum intsall httpd

2. Let’s Assume that your domain name is example.com. So we need to create directory for your domain example.com in /var/www/html/

Navigate to /var/www/html/
cd /var/www/html/
Create directory for your website.
mkdir example.com
Directory will be created, you can check that with the help of command below
ls
Now, Navigate to example.com
cd example.com
Create an index file here
touch index.html
Insert content in index.html using your favorite editor, Here i will be using VI
vi index.html
press i (to start Writing) on vi editor
Welcome to example.com

3. Now Open your Apache configuration file , with your favorite editor
vi /etc/httpd/conf/httpd.conf
Insert below lines at the bottom of the httpd.conf file
<VirtualHost *:80>
DocumentRoot /var/www/html/example.com
ServerName example.com
ServerAlias www.example.com
</VirtualHost>

The various paramaters in Virtual Host are:

DocumentRoot: This directive sets the directory from which httpd will serve files for this host.
ServerName: Used to uniquely identify the Virtual Host; FQDN (Fully Qualified Domain Name) format to be used.
ServerAlias: This directive is used to set the alternate names for the host.

4. Now restart your Apache
service httpd restart

Now your Website will be live, you can check it on your System Browser.

That’s all for this Post. In Next Post i will be discussing about hosting MySql Server On VPS.

If you like this Post do like and share. Thanks