Hello friends, welcome to KDJ Guru Blog. In this article, you will be able to learn very basic stuff for a VPS Hosting. I’m not an expert in VPS. But, I started to use VPS with a lot of issues. Few of them are, Where is the Public_html folder (I know, it’s a silly one. But I was a shared Hosting user), How to install apache, nginix or open Litespeed, How to install SSL and more.


To follow this tutorial, you will need the following requirements:

  • a VPS (Purchase a VPS from KDJ Hosting)
  • a domain name pointed to your server

However, Let’s work on how to Install the webserver with Apache. For anything you are going to do, already should have an OS installed VPS and you must be logged into the VPS using Putty.


On Ubuntu.

apt update
apt install apache2 php-{bcmath,bz2,gd,intl,mcrypt,mbstring,mysql,xml,xmlrpc,zip}
apt install libapache2-mod-php

On Centos

yum update
yum groupinstall 'Web Server'
yum install apache2 php-{bcmath,bz2,gd,intl,mcrypt,mbstring,mysql,xml,xmlrpc,zip}=

After typing above code lines, you need to enable and start apache for your server. Then you can use your ip or hostname to navigate.

On Ubuntu

systemctl enable apache2
systemctl start apache2

On CentOS

systemctl enable httpd
systemctl start httpd

Multiple Domains on Your VPS (Create Virtual Hosts)

If you are going to host only one website on your server, you don’t need to do anything then. But if you need to host multiple websites with subdomains/domains, you must do this.

First, you must know, there is no public_html folder like the Cpanel thing on VPS. you have to use “/var/www/html” path as your apache running location and upload directory. Anyways, we will make a virtual host with a domain name domain1.com, please change it with your domain name.

Virtual Host Configuration

On CentOS

nano /etc/httpd/conf.d/domain1.com.conf

On Ubuntu

nano /etc/apache2/sites-available/domain1.com.conf

After running the above command, you must add the following lines to the configuration file.

<VirtualHost *:80>
ServerAdmin webmaster@domain1.com
ServerName www.domain1.com
ServerAlias domain1.com
DirectoryIndex index.php index.html
DocumentRoot /var/www/html/domain1.com/public_html
LogLevel warn
ErrorLog /var/log/httpd/domain1.com_error.log
CustomLog /var/log/httpd/domain1.com_access.log combined

Since /etc/httpd/conf.d/*.conf files are already included in /etc/httpd/conf/httpd.conf, there is no more step in CentOS

But on Ubuntu/Debian, we have to enable the virtual host first by performing this command.

a2ensite domain1.com

a2ensite domain1.com

Restart Apache

On CentOS

systemctl restart httpd

On Ubuntu

systemctl restart apache2

Now let’s make a file in /var/www/html/domain1.com/public_html, just replace the domain1.com with your actual domain name.

mkdir -p /var/www/html/domain1.com/public_html
nano /var/www/html/domain1.com/public_html/home.html

After entering the above lines, insert the following line to the home.html file.

<html><center><h1>This is loaded from domain1.com</h></center></html>

Check the Domain

Yes, now you just have to type your domain and check whether it works or not. Remember, DNS propagation should be completed to see the output. Use this link to check it.

Installing a CMS on VPS (WordPress Installation)

Most of the website we can see on the internet is now built with WordPress. Because it will save our development time and make our work easy on any side. In this tutorial, We will learn how to install WordPress without using FileZilla.

To Download WordPress, execute the following commands,

wget wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
mv wordpress/* .

On Ubuntu

chown -R apache: /var/www/html/domain1.com/public_html

On CentOS

chown -R www-data: /var/www/html/domain1.com/public_html

Install MySQL

You should use

Write A Comment