Beginner – CloudMinister

How to configure Domain Name with VirtualHost in Centos 7 VPS and attach SSL certificate?

Several providers provides Domain Name service to its customer so that people need not remember the IP address of the web server. With the help of DNS the IP address can easily resolve with Domain Name and Vise Versa.

Prerequisite


1. Domain Name – Free(Freenom), Paid(Godaddy)

  1. VPS – Centos 7
  2. 3. Web Server – apache, nginx


Configure Domain Name


In this blog we are going to take Free Domain Name from
https://www.freenom.com, you can also purchase it from Godaddy.

Now follow the steps to configure the Domain Name:

  1. Open the above given website and search for new domain.
  2. Select the required domain and click on checkout option.
  3. Now click on Use DNS option and also give the IP address of your VPS, also select the period from top right corner and then click on continue.

  4. Click On Agree all the Terms and Condition checkbox and complete the shopping.

  5. After that go inside the Domain Name and click on DNS management for your Domain.

 

Configure VPS


VPS stands for Virtual Private Server are the servers provided by many organizations like AWS, Azure that are used as 

Web Server for Website Hosting and Database Server for storing database of all the customer.

For Example, Centos, Ubuntu, etc.

Now follow the steps to configure VirtualHost in Centos 7 VPS.
1. Open the server with SSH and type sudo command for non-root users.

After that go inside the /var/www/html directory and create new directory over their with the Domain Name by using the following command:

    # sudo cd /var/www/html

# sudo mkdir yourdomain.com

# sudo cd yourdomain.com

# sudo vi index.html

  1. After then write “Website under construction”. 

Now create new conf file with server name in conf. directory

# sudo cd /etc/httpd/conf.d

# sudo vi yourdomain.com.conf

  1. Now write the following code to create Virtual Host,

<VirtualHost *:80>

   DocumentRoot “/var/www/html/learalot.ga”

   ServerName learnalot.ga

   ServerAlias www.learnalot.ga

  <Directory “/var/www/html/learnalot.ga”>

    Options FollowSymLinks

    AllowOverride All

    Options -Indexes

  </Directory>

Redirect Permanent / https://learnalot.ga <—-> If you want to redirect http traffic to https.
</VirtualHost>

<VirtualHost *:443>

   DocumentRoot “/var/www/html/learnalot.ga”

   ServerName learnalot.ga

   ServerAlias www.learnalot.ga

  <Directory “/var/www/html/learnalot.ga”>

    Options FollowSymLinks

    AllowOverride All

    Options -Indexes

  </Directory>

</VirtualHost>

And save the file with :wq command.

 

Configure Web Server

 

For configuring Web Server you first decide which server you want to use for hosting website, Like apache, nginx, Microsoft IIS select any server based on your requirement.

In this we are going to install apache web server by using the following command:

    # yum install -y httpd

    # systemctl start httpd

    # systemctl enable httpd

 

Configure SSL certificate

 

SSL stands for Secure Sockets Layer is a standard security technology for establishing an encrypted connection between the server and the client, Like Mail Server and Web server(Browser) and Mail Client.

Steps to configure the Let’s Encrypt Free SSL certificate in centos7 VPS.
1. Open this URL
https://certbot.eff.org/ and click on Get certbot  instruction options.


  1. Now select the software and VPS in which your website is running.

  2. Run VPS with SSH and use sudo if you don’t have root privileges.
  3. Enable EPEL repository by using the following command:
    # yum install -y
    https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  4. Now after that enable the optional channel by using the following command:

    # yum -y install yum-utils

    # yum-config-manager –enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

6. Install certbot by using following command:

    # yum install certbot python2-certbot-apache


  1. Run this command to get a certificate and have Certbot edit your Apache configuration automatically to serve it, turning on HTTPS access in a single step. 

# certbot –apache


  1. Set up automatic renewal

# echo “0 0,12 * * * root python -c ‘import random; 

import time; time.sleep(random.random() * 3600)’ && certbot 

renew” | sudo tee -a /etc/crontab > /dev/null


  1. Confirm that certbot worked by clicking on the particular website.

https://www.ssllabs.com/ssltest/

  1. Enter your domain name and it will show that website is secured or not.

 

Test your Domain Name

 

Now after completing the above installation go to any browser and type the Domain Name yourdomain.com in the URL to check the configuration.

Before

After


CONCLUSION-

In this blog you can learn how to configure Domain Name with VirtualHost in centos 7 VPS and also learn how to configure SSL certificate in your website by using Let’s Encrypt Free SSL service provider.

How to improve GTMetrix score of websites?

GTMetrix

It is a tool that is used to get more and more detailed reports about our site’s performance. It is a free tool that analyzes your page’s speed performance using Google Page Speed and YSlow. 

 

In addition, Google uses page speed in their ranking algorithms. Therefore, a faster performing site may rank higher in search engine results.

Earlier Report

 

To improve your score here, the first thing you must purchase a server from the VPS server provider who provides compression on their server like CloudMinister Technologies. Without server compression, you won’t be able to get a good score.

 

Few more steps you need to consider to get a good score from GTMetrix like Optimize images, Enable caching, Minify HTML, JavaScript code, activate CDN.

 

  • Enable Compression From server-side

 

 

It mostly happens that most of the server providers don’t enable compression by default, so we need to find those server providers who provide compression with the server.

 

 

  • Optimize Images

 

To get more score from GTMetrix we need to optimize all those images that we put on the websites because in large size images it takes more time to load, follow these steps to optimize images.

> Name your images descriptively and in plain language.

> Optimize your alt attributes carefully.

> Choose your image dimensions and product angles wisely.

> Reduce the file size of your images.

> Choose the right file type.

> Optimize your thumbnails.

> Use image sitemaps.

> Beware of decorative images.

> Use caution when using content delivery networks (CDN’s).

> Test your images.

 

 

  • Minify HTML , JavaScript code & CSS code

 

We need to Minify HTML & JavaScript as well as CSS code with this content will read fast by the browser and help your viewers to see the website more quickly. Cloudflare provides this feature to enhance the score on GTMetrix.

 

 

  • Activate CDN

 

A content delivery network (CDN) is a system of servers spread over multiple data centers located around the world. When a user visits your site they will be served content from the server closest to them.

The most popular CDN is Cloudflare – to activate you will need to sign up and add your site to a free plan. Once this is done you will need to change your nameservers so the domain looks towards Cloudflare. This can take up to 24 hours for the DNS to update but is usually much quicker.

After covering all the above points you will be able to get a better score over GTMetrix.

Conclusion – The above configuration shows how to achieve a better score on the GTMetrix, by following all these points your viewer will be able to visit your website more quickly. 

How to create FTP user in CWP panel ?

In CWP panel today I will show you how to create an FTP user so let’s start now. Please do follow my given instructions

Step1- Open CWP login panel
Step2-  Open file manager to create FTP account
Step3-  Check to transfer file

panel

After login into CWP panel go-ahead for further steps -:
Click on File Manager –> FTP Manager V2 –> add user  here I create a user name gulfam@kazakhculturalcentre.com, please keep in your mind password or FTP port 21

ftp_manager

To verify FTP working or not first you already have Filezilla file transfer software in your system. Here you see snapshot how to login into Filezilla. There are two ways to login first via the IP address of the server and second via the domain name.

filezilla cwp

Conclusion: Now you see easily your FTP user login in Filezilla hope you will get benefits from this document.

File compression in Linux

Here you will learn about the file compression and the full overview of types of file compression

File compression used to contain two or more file & directory in smaller size rather than original. Compression means reduce size of file.

In linux have many types of file compression
1. gzip

2. bzip2
3. xz
4. zip

 

# du -sh filename/or/path (This command use to check the size of file)

# yes “string” > file_name (This command use to copy string into file)

Alert :- immediately press (ctrl + c) after use yes command.If you not press (ctrl +c) immediately file size increase every second.

example :- 

  1. gzip :-

gzip is used to compress file but gzip not reduce more  size as compared to others. gzip extension is .gz.   

# gzip file_name (This command used for compress the file in .gz extension)


Uncompress gzip command

# gunzip  file_name.gz (This command used to unzip .gz file)

Example:- 


Create compress and tar file simultaneously 

#tar cvzf destination\path/file_name.tar.gz /source/path/ (This command used to compress in gz format and convert in tar file)

Example:- 


Uncompress and untar  file simultaneously

# tar xvzf file_name.tar.gz (This command used for uncompressing and untar file those extensions have .tar.gz or .tgz)

Example:- 

  1. bzip2

bzip2 is used to compress file bzip2 to reduce the size as compared to gzip. Bzip2 takes time to compress. Bzip2 extension is .bz2

# bzip2 file_name (This command used to compress the file with extension .bz2)

Uncompress bzip2 command

# bunzip2  file_name.bz2 (This command used to unzip .bz2      file)

Example:- 


Create compress and tar file simultaneously using bzip2 

#tar -cvjf destination\path/file_name.tar.bz2 /source/path/ (This command used to compress in bzip2 format and convert in tar file)

Example:- 

Uncompress and untar  file simultaneously using bzip2

# tar -xvf file_name.tar.gz (This command use for uncompress and untar file those extensions have .tar.bz2 or .tbz or .tb2)

Example:- 

  1. Xz

xz is used to compress file xz reduce more size as compared to other compression method.xz  extension is .xz.

# xz file_name (This command used to compress file with extension .xz)

Example:- 

Uncompress xz command

# unxz  file_name.bz2 (This command used to unzip .xz  file)

Example:- 


  1. Zip

Zip is used to compress the file or folder so that reduce the size of that package.
zip is available in linux,windows and unix. Many other software available that work same as zip. example:- WinRAR, 7zip etc.

 

Note: before use zip command first install zip package.

In centos installation :- # yum install zip -y

In ubuntu installation :- # apt-get install zip -y

Zip current all directory and file

# zip file_name.zip * (This command use to zip all current working directory and file) 

Recursively zip all directory file

# zip -r file_name.zip directory\path (This command use to recursively zip all file in a directory)

Exclude some file in zip 

# zip -r file_name.zip directory\path –exclude “*.extension”

(This command use to zip all file in directory but exclude some files using exclude option)

Extract zip file 

# unzip file_name.zip (This command use to extract zip file)

Extract zip file into directory 

# unzip file_name.zip -d directory\path (This command use to extract zip file into a directory)

By following this tutorial you will configure Centos Web Panel on your server through shell :-

Before installing CWP, you must know the following information:

:- CWP only supports static IP addresses. It does not support dynamic, sticky, or internal IP addresses.
:- CWP doesn’t has an uninstaller. After you install CWP, you must reinstall the server to remove it.
:- Only install CWP on a freshly installed operating system without any configuration changes.
:- Need atleast 512MB RAM for 32 bit systems.
:- 1024MB for 64 bit systems.
:- Need 4GB RAM or more to deploy all modules.
:- At least 20GB or hard disk space is required.

Step 1 :- Install Wget Package.

# yum install wget -y

Step 2 :- Update your server.

# yum update -y

Step 3 :- Download and Install CWP.

Download latest CWP version with command:

# wget http://centos-webpanel.com/cwp-latest

If the above URL doesn’t work, use the following link instead.

# wget http://dl1.centos-webpanel.com/files/cwp-latest

Then, start CWP installer using command with maria db database:

# sh cwp-latest -d mariadb

Now You can login your centos web panel on browser with URL :- https://xxx.xxx.xxx.xxx:2031

Conclusion: by following this tutorial you will able able to configure CWP panel.

Ports numbers those are used in Hosting 

These are the commonly port no. that are used in different type odf panels

Panel Port Numbers

Cpanel

Way of establishing an unencrypted connection to the server through http 

opens a connection to the port number 80

2082

Cpanel-SSL

It is the way of establishing an encrypted connection to the server through a secure socket layer through https  opens a connection to the port number 443

2083

Webmail

2095

Webmail-SSL

2096

WHM  (Web Host Manager)

It is a powerful program that allows administrative access to the back end of cPanel.

2086

WHM-SSL

2087

plesk  -: Web hosting platform with a control panel that allows a server administrator to set up new websites, reseller accounts, e-mail accounts and DNS entries

8880

plesk-SSL

8443

CWP ADMIN ( Centos Web Panel)

2030,2086

CWP ADMIN-SSL

2031,2087

CWP User-SSL

2083

CWP User

2082

Protocols Port Numbers

These are the commonly port no that are used in the below protocols

POP 3

110

POP 3-SSL

995

SMTP ( Simple Mail Transfer Protocol)

SMTP is a set of communication guidelines that allow software to transmit an electronic mail over the internet is called Simple Mail Transfer Protocol.

25

SMTP_SSL

465

SMTP alternate

26,587

IMAP (Internet Message Access Protocol)

 The Internet Message Access Protocol is an Internet standard protocol used by email clients to retrieve email messages from a mail server over a TCP/IP connection

143

IMAP-SSL

993

MYSQL  -MySQL is an open-source relational database management system.

3306

RDP (Remote Desktop Protocol)

Remote Desktop Protocol is a proprietary protocol developed by Microsoft which provides a user with a graphical interface to connect to another computer over a network connection

4489

MSSQL

1433

SSH  (Secure Shell)

Secure Shell is a cryptographic network protocol for operating network services securely over an unsecured network

22

FTP (File Transfer Protocol)

21

FTPs

990

SFTP – : SSH File Transfer Protocolthe

SSH File Transfer Protocol is a network protocol that provides file access, file transfer, and file management over any reliable data stream

22

MongoDB -:MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program

27017

Postgresql

5432

DNS

53

MTA

25

Conclusion: By using this port no you will be able work on panel and use the protocols easily.

mbps

How to check Internet speed in Linux machine ?

Their is a question arise why we are checking the internet speed, so here is the answer:
–>To optimise the speed for the resources which we are utilising so that we can give the optimum speed for the resources which it requires.
–>To increase the bandwidth so there must not be any hindrance in uploading as well as downloading.

Step1:- First install wget on linux machine.

         # yum -y install wget

Step2:- download network tester tool using this command

         # wget https://github.com/ddo/fast/releases/download/v0.0.4/fast_linux_amd64 -O fast

speed_test1

Step3:- give execute permission to download  fast file using

         # chmod +x fast

speed test2

Step4:- run fast file to test  speed

         # ./fast

speed1

Conclusion:  By completing this you will understand how to test the speed on Linux machine.

What is a HOSTS file and How do you modify the HOSTS file in different operating system?

–>HOSTS File

HOSTS file is found inside an operating system, that helps to resolve hostname with an IP address before checking in DNS.

In your system, you want to access www.yourdomain.com hostname your system first actually resolve the hostname with IP address of the server.

 

To resolve the IP address it will first check inside HOSTS file which is a simple text file that store entries of hostname with the IP address, and if not found then it goes to your Internet Service Provider(ISP) or DNS server

It is helpful in case of troubleshooting or publishing a website for testing purposes by giving entry in the HOSTS file which resolve hostname with IP address locally before checking in DNS.

 

To modify your HOSTS file in Linux
In Linux the HOSTS file is found inside the /etc directory in the form of simple text file that can be modified by using text editors like:

 1) nano

 2)vi

Open file using the nano editor:

# nano /etc/hosts

 Open file using the vi editor:

# vi /etc/hosts

Image

Note: Use sudo before the following command if you don’t have root privileges:

 After the file is open, give entries of IP address and hostname in the desired manner:

 IP_address        Hostname

 For example:

 111.222.111.222        www.yourdomain.com

 And after that safe file with:

1) Press ctrl + o to save file and ctrl + x to exit from a file if you are  using a nano editor.

2) Press Esc button and write :wq if you are using vi editor.

Image

To modify your HOSTS file in Windows 10

 In windows operating system the hosts file is found inside the c:\\windows\System32\drivers\etc folder to configure it follow the steps:

1) Press Win + r button and search for notepad and should be open with run as administrator

the other entry will not get saved .

image

2) Click on File and select open option, after that goes inside the above specified folder.

image

3) Select All files and now select the hosts file.

image

image

4) After file is open give entry in the last block i.e. localhost name resolution:

#    IP_Address    Hostname

 For example:

#    111.222.111.222        www.yourdomain.com

image

5) Now save the file with the ctrl + s button.

image

To modify your HOSTS file in Mac os

In Mac os  HOSTS file is found under the following path i.e

/private/etc/hosts, you can easily edit it with nano editor by follows the steps:

  1. On your system, select Application > Utilities > Terminal to open a terminal window.

Image

  1. Now open the HOSTS file by using the following command:

# sudo vi /private/etc/hosts

Note: use sudo if you don’t have root privileges.

Image

  1. Now edit the hosts file.

Add your new mapping after the default mapping i.e. (12.0.0.1 – localhost).

  1. To save and exits the HOSTS file, press :wq.

Image

  1. Now ping with the same domain name to check the connection is established or not.

Image

CONCLUSION- The above configuration shows how you can troubleshoot and publish websites for testing purposes by modifying the HOSTS file.

Choosing the correct hosting control panel for your Hosting VPS or dedicated server

There are lots of open source as well as paid control panel through you can manage vps and dedicated servers, Control are being used by server admin to setup and manage the server and all services required for hosting like mail server , LAMP stack i.e apache, mysql, php and its modules effectively and By deciding correct control panel admin and user can save lots of its time and money too.

There are some advantages and disadvantages of control panels I am going to explain here .

1. GUI interface for admin and user end
2. resource consumption
3. Automation
4. Paid or open source
5. Advantages over multiple site hosting (shared Hosting)
6. Tomcat Hosting

1. WHM and cpanel

Advantages:

  • GUI of whm is best for admin and user end.
  • Automation is good in terms of auto backup, php modules installation configuration ,security ,multiple php modules.
  • Best for multiple site hosting (shared server for hosting companies).
  • All mysql versions can be installed by whm graphically in no time.
  • Best for Reseller Hosting.

Dis Advantages:

  • License for vps is 14.95 USD per month and for dedicated is 34.95 USD per month.
  • Resource hungry required minimum 2 GB RAM for installation and generally high load issue arise when resources are less.
  • Manual installation of nginx as a reverse proxy and varnish ,litespeed caused many issues over apache.
  • Apache is only supported be default as a web server.
  • Only support linux server.
  • Tomcat automation is not good on whm like setup and war file deployment is not quite easy.

2. Centos Web Panel

Advantages:

  • GUI of whm is good for admin and user end.
  • Automation is good in terms of auto backup, php modules installation configuration ,security ,multiple php modules.
  • Best for standalone servers or few personal websites server.
  • All php versions can be installed by cwp graphically in less time.
  • multiple web server support with front end cache server like nginx as a reverse proxy and varnish with apache.
  • Its a opensource control panel .
  • Consume less resources.

Dis advantages:

  • Not good for shared server where thousands of websites are hosted.
  • Mysql automation for upgrade option is missing.
  • Only support linux servers.
  • Tomcat automation is not good on centos web panel like setup and war file deployment is not quite easy.
  • Not good for Reseller Hosting.

3. Plesk control panel

Advantages:

  • GUI of whm is good for admin and user end.
  • Automation is good in terms of auto backup, php modules installation configuration ,security ,multiple php modules.
  • Good for Shared hosting servers .
  • All php versions and mysql versions can be installed graphically in less time.
    nginx and apache both supported .
  • support linux and windows OS .
  • Tomcat automation is good on plesk like setup and war file deployment is quite easy.
  • Good for reseller Hosting.

Disadvantages:

  • License cost for vps and dedicated on monthly basis.
  • Resource hungry required minimum 2 GB RAM for installation and generally high load issue arise when resources are less.
  • Manual installation of nginx as a reverse proxy and varnish ,litespeed caused many issues over apache.
  • Some times typical issues arise troubleshooting for admin is hard.
  • Do not support DKIM authentication on mail server yet.

4. Virtualmin

Advantages:

  • GUI of virtualmin is not so good for admin and user end.
  • Automation is less.
  • Can be used for standalone server.
  • nginx and apache web server both supported but manual install is required .
  • Its a opensource control panel .
  • Pro license has some cost for support .
  • Used less resources of server for automation.

Disadvantages:

  • Not good for shared server where thousands of websites are hosted.
  • Mysql automation for upgrade option is missing .
  • Manual installation of nginx as a reverse proxy and varnish ,litespeed caused many issues over apache.
  • Some times typical issues arise troubleshooting for admin is hard.
  • Only support linux servers.
  • Tomcat automation is not good on virtualmin like setup and war file deployment is not quite easy.
  • Not good for Reseller Hosting.

Get started with CloudMinister Today