Secure your Linux based Virtual private server/cloud server

Table of content …

  1. Why security is measure concern with a virtual or dedicated server
  2. General security tips
  3. Firewall based Security
  4. SSH Hardening
  5. Malware/virus/Hacking prevention tools

Secure your Linux based VPS

It’s nice that you are upgrading your website from shared hosting to VPS hosting to provide more power, more speed, more freedom, more resources, more flexibility and so on.

But when you move to VPS / dedicated server it’s security becomes an important aspect for your websites & apps data.

Security includes malware protection, virus protection, intrusion detection and protection, bandwidth stealing prevention, spam relay prevention, and much more things need to focus from a security point of view.

Here we will discuss step by step tips for virtual & dedicated server security tips.

Basic security measures

  1. Keep your system up to date cause software update is the biggest security measure itself, the software update includes various vulnerabilities, patches. If possible schedule automatic software updates.
  2. Add limited user accounts with minimum required permissions.
  3. Remove Unused Network-Facing Services

Firewall based security

With Cpanel installation configure lfd and CSF firewall on the server, iptables (for ipv4 and ipv6 ports)

SSH hardening

configure ssh on nonstandard ports, install fail to ban

Malware / virus / Hacking protection tools



On Page SEO

Use of  keyword Phrase during On Page SEO

    1. In the title tag at least one:– keep the keyword phrase as close to the beginning of the title tag as possible
  • Once prominently near the top of the page
    1. At least two or three times, including variations, in the body copy on the page. Perhaps a few more times if there’s a lot of text content. You may find additional value in using the keyword or variations more than this, but in our experience adding more instances of a term or phrase tends to have little or no impact on rankings.
    2. At least once in the alt attribute of an image on the page. This not only helps with web search but also image search, which can occasionally bring valuable traffic.
  • Once in the URL
  1. At least once in the meta description tag – Note that the meta description tag does not get used by the engines for rankings, but rather helps to attract clicks by searchers reading the results page, as the meta description becomes the snippet of text used by the search engines.

Note: And you should generally not use keywords in link anchor text pointing to other pages on your site; this is known as Keyword Cannibalization.

Title Tag Format

Optimal Format

Primary Keyword – Secondary Keyword | Brand Name

Means start tile with your keyword

Link Building strategy:-

  1. Get your customers to link to you
  2. Build a company blog; make it a valuable, informative, and entertaining resource
  3. Create content that inspires viral sharing and natural linking
  4. Be newsworthy

Search Engine tools

  1. Sitemap
  2. Robots.txt
  3. Meta Robots
  4. Rel=”Nofollow”
  5. Rel=”canonical”

Often, two or more copies of the exact same content appear on your website under different URLs. For example, the following URLs can all refer to a single homepage:


To search engines, these appear as five separate pages. Because the content is identical on each page, this can cause the search engines to devalue the content and its potential rankings.

The canonical tag solves this problem by telling search robots which page is the singular, authoritative version that should count in web results.

  • An Example of rel=”canonical” for the URL
  • <html>
  •  <head>
  •    <title>The Best Webpage on the Internet</title>
  •    <link rel=”canonical” href=””>
  •  </head>
  •  <body>
  •    <h1>Hello World</h1>
  •  </body>
  • </html>

In the example above, rel=canonical tells robots that this page is a copy of, and should consider the latter URL as the canonical and authoritative one.

How to optimize WordPress for site speed

We know that WordPress is a widely used content management system on the web. You are also one of WordPress user, using WordPress for your site, but facing high load time for your site, due to slow page load of your WordPress. Here’s how we can check and improve our overall site speed.

Why Good site speed required.

Website load speed plays an important role in your website google search ranking as well as for great user experience. Google’s search algorithm includes your page load times as one of the many parameters while calculating PageRank.

Here’s why Google like good site speed

What do Bing experts say about site speed?

According to a report by the Microsoft Bing search team, a 2-second longer delay in page responsiveness reduced user satisfaction by 3.8%, increased lost revenue per user by 4.3%, and reduced clicks by 4.3%.

Let’s check and improve your Site speed.

To check your site speed, get help from these awesome tools.

  1. Webpagetest
  2. Gtmetrix
  3. Page speed tools by google

Once you have checked and find some issues with your site, now fix them.

Here are some other things which also need to check or do in terms of site speed improvements.

  1. Choose a good WordPress Hosting

Yes, this is the most important aspect of your site speed, that you choose a good WordPress hosting provider with good hardware and network availability.

Here’s our Guide on How to choose a Web Host

Now we also need some software or plugins to tweak the performance of your WordPress site.

  1. Use Caching

Via plugins:– For WordPress caching you can use plugins W3 Total Cache or WP Super Cache. These plugins will convert your WordPress posts as static files and these static files are then the server to Users to reduce server processing load. When combined with a system level page cache such as Varnish, this can be quite powerful.

Browser caching:– with browser caching, we’re explicitly instructing browsers to hang onto particular files for a specified period of time. When the file is needed again, the browser is to pull from its local cache instead of requesting it from the server again.

Server caching: – more complex but it is used in very high traffic sites, simplest solutions start with the server caching locally while more complex may use multiple caching servers (also known as reverse proxy servers) “in front” of web servers where the WordPress application is actually running. Adding an opcode cache like Alternative PHP Cache (APC) to your server will improve PHP’s performance by many times.

  1. Image Optimization

Images may slow down your WordPress if they are not optimized for speed.

How to know if your images are slowing your site down use Pingdom website speed test. This will tell you your overall load time and site size. The best practice is less than 3 seconds and smaller than 1mb

  1. WordPress database optimization

wp-optimize plugin for database cleanup and optimization without phpmyadmin.

We would also recommend the WP-DBManager plugin, which can schedule dates for database optimization.

  1. Minify HTML, CSS & Javascript    All that blank space, comments, new line characters and anything redundant in your code that makes it easier on the eye without purpose is completely useless to a server and the IP that trying to reach out to your servers requesting your site.

Remove all this stuff with a free caching plugin and your site will be better off in terms of performance.

  1. Minimize the number of HTTP requests    When someone visits your website, the corresponding files must be sent to the user’s browser. This includes CSS files, Javascript library references, and images. Having a high number of files requiring multiple server requests is not efficient at all. You can reduce this by combining JS scripts, HTML and CSS files together.
  2. Replace PHP With Static HTML PHP is great for making a website efficient and reducing the need to enter the same information multiple times. However, calling information through PHP uses up server resources and should be replaced with static HTML where it doesn’t save any time.
  3. GZIP Compression  Large pages (which is what you could have if you’re creating high-quality content) are often 100kb and more. As a result, they’re bulky and slow to download. The best way to speed their load time is to zip them—a technique called compression.

Enabling gzip compression on your site will reduce the amount of data sent from your server to the visitor’s browsers, thus increasing the page-load speed.

  1. USE CDN  Content delivery networks work by hosting your files across a large network of servers around the World. When a user visits CDNs hosted sites, CDNs provide them files from the server that is closest to them. Because the bandwidth is spread across so many different servers, it reduces the load on any single server and also protects your sites from DDoS attacks and traffic spikes, hosting your files or media on the content delivery network is one of the best ways to improve your site speed. CDN also saves up to 60% of total bandwidth consumption.
  2. Use Lazy Load For Text, Videos & Images

How to migrate wordpress from existing hosting provider to PnS Hostings WordPress Hosting

How to migrate WordPress from existing hosting provider to PnS Hostings WordPress Hosting Planning to move your WordPress to another host or with PnS Hostings WordPress hosting service. Then you are in the right place, nothing need to worry about migration. Here we will tell you to step by step process of WordPress migration from a regular host.

Migration involves 3 Major steps

  1. Backup of WordPress database on the existing host and transfer backup on PnS Hostings hosting account.
  2. Download all WordPress files from the existing host server and upload them on PnS Hostings server.
  3. Finally, restore your database backup and make necessary changes on the wordpress config file.

Now let’s start with WordPress database backup on existing hosting account as almost all regular hosting provider offer phpmyadmin with their hosting services, so make use of phpmyadmin for database backup and export backed up database and move this backed up database file (it will .sql file) with the help of  scp or rsync or FTP client (depending upon which most suits for you)

In next step login into existing WordPress hosting account and download all WordPress files on your local computer, once you have finished all files download, then login into PnS Hostings WordPress hosting account via FTP client and start uploading all files to PnS account after completion of this upload move to next step.

Upon successful file transfer, you need to import your backed up database file on PnS WordPress account hope you know how to import the database using phpmyadmin. After the successful import of database, you have to edit your WordPress configuration file according to your new database details. If all will be done properly, and after DNS records update according to PnS server your WordPress should work fine on PnS servers.

Important: if you change the domain name of your site then additional configuration may be required.  

How to Install dkim on centos 7

  1. Enable EPL repository.

In centOs 7

sudo rpm -Uvh epel-release-7*.rpm


In Cent os 6

           rpm -Uvh epel-release-6*.rpm

  1. Install opendkim

yum install opendkim


mkdir /etc/opendkim/keys/$domain

/usr/sbin/opendkim-genkey -D /etc/opendkim/keys/$domain/ -d $domain -s $selector

chown -R root:opendkim /etc/opendkim/keys/$domain

chmod 640 /etc/opendkim/keys/$domain/$selector.private

chmod 644 /etc/opendkim/keys/$domain/$selector.txt




# Specifies the path to the process ID file.
PidFile /var/run/opendkim/

# Selects operating modes. Valid modes are s (signer) and v (verifier). Default is v.
Mode    sv

# Log activity to the system log.
Syslog  yes

# Log additional entries indicating successful signing or verification of messages.
SyslogSuccess yes

# If logging is enabled, include detailed logging about why or why not a message was
# signed or verified. This causes a large increase in the amount of log data generated
# for each message, so it should be limited to debugging use only.
#LogWhy yes

# Attempt to become the specified user before starting operations.
UserID  opendkim:opendkim

# Create a socket through which your MTA can communicate.
Socket  inet:[email protected]

# Required to use local socket with MTAs that access the socket as a non-
# privileged user (e.g. Postfix)
Umask   002

# This specifies a file in which to store DKIM transaction statistics.
#Statistics              /var/spool/opendkim/stats.dat
# Selects the canonicalization method(s) to be used when signing messages.
Canonicalization        relaxed/simple
# Domain(s) whose mail should be signed by this filter. Mail from other domains will
# be verified rather than being signed. Uncomment and use your domain name.
# This parameter is not required if a SigningTable is in use.
# Defines the name of the selector to be used when signing messages.
Selector                default
# Gives the location of a private key to be used for signing ALL messages.
#KeyFile                 /etc/opendkim/keys/default.private
# Gives the location of a file mapping key names to signing keys. In simple terms,
# this tells OpenDKIM where to find your keys. If present overrides any KeyFile
# setting in the configuration file.
KeyTable                 refile:/etc/opendkim/KeyTable
# Defines a table used to select one or more signatures to apply to a message based
# on the address found in the From header field. In simple terms, this tells
# OpenDKIM how to use your keys.
SigningTable                 refile:/etc/opendkim/SigningTable
# Identifies a set of “external” hosts that may send mail through the server as one
# of the signing domains without credentials as such.
ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts
# Identifies a set internal host whose mail should be signed rather than verified.
InternalHosts           refile:/etc/opendkim/TrustedHosts





How to add swap partition on Centos 6 On KVM

Before we proceed to setup a swap file we need to check  if any swap files have been enabled by looking at the summary of swap usage.

swapon -s

If nothing returned that menas swap file is empty.

Now we have confirmed that we do not have any swap file enabled next we will check available disk space on server with df command


Filesystem     1K-blocks Used Available Use% Mounted on

/dev/vda1       20125372 813952 18289172   5% /

Create and Enable the Swap File

dd if=/dev/zero of=/swapfile bs=1024 count=512k

“of=/swapfile” designates the file’s name. In this case the name is swapfile.

Subsequently we are going to prepare the swap file by creating a linux swap area:

mkswap /swapfile

The results display:

Setting up swapspace version 1, size = 536866 kB

Finish up by activating the swap file:

swapon /swapfile

You will then be able to see the new swap file when you view the swap summary.

swapon -s
Filename Type Size Used Priority
/swapfile                               file 524280 0 -1

This file will last on the server until the machine reboots. You can ensure that the swap is permanent by adding it to the fstab file.

vi /etc/fstab

/swapfile          swap swap    defaults 0 0

To prevent the file from being world-readable, you should set up the correct permissions on the swap file:

chown root:root /swapfile
chmod 0600 /swapfile

How To Configure Swappiness

The operating system kernel can adjust how often it relies on swap through a configuration parameter known as swappiness.

To find the current swappiness settings, type:

cat /proc/sys/vm/swappiness


Swapiness can be a value from 0 to 100. Swappiness near 100 means that the operating system will swap often and usually, too soon. Although swap provides extra resources, RAM is much faster than swap space. Any time something is moved from RAM to swap, it slows down.

A swappiness value of 0 means that the operating will only rely on swap when it absolutely needs to. We can adjust the swappiness with the sysctl command:

sysctl vm.swappiness=10


If we check the system swappiness again, we can confirm that the setting was applied:

cat /proc/sys/vm/swappiness


To make your VPS automatically apply this setting every time it boots up, you can add the setting to the/etc/sysctl.conf file:

sudo nano /etc/sysctl.conf

# Search for the vm.swappiness setting.  Uncomment and change it as necessary.

Email newsletter design tips

An email newsletter is a perfect way to stay connected with your followers and clients.

Figure out what kind of email design templates you want to send Before getting into design aspect first you should clarify what kind of newsletter you want to send whether text-based or HTML based. If going with text-based than directly think about text layout and content which you want to send. But for HTML based newsletters you have to think beyond content and layout.
Here we are discussing HTML newsletter design aspects which you have to keep in mind while designing every HTML based newsletter.
Use tables in your Layout – In today’s modern web standards this may seem a bit contradictory but e-mails are still archaic in their rendering engines, thus you have to build towards older models. Tables are the easiest way to get everything working properly among the various e-mail clients. You may also wonder why div and other block elements are not such a good idea. Most e-mail clients are built to strip away any extraneous CSS content. This means you won’t be able to use much of anything except for inline CSS. Clients such as Microsoft Outlook 2007 and Google’s Gmail have very poor support for floated elements and direct positioning.
Best to nest multiple HTML tables each other.
Fixed width positioning – Fluid elements in your newsletter need to size a few things so you should try to keep size in pixels rather than in another unit.
Working within the 600px max width limit, you can actually fit a lot of content inside. Exposure is easier if you split your layouts into two or three columns, and always write your sizes in pixels. The only exception may be to font sizes where ems can support your readers better, but em sizing will differ in similar way percentages would – so for simplicity’s sake, stick to pixel-based alignments.
c. CSS use – If you can build what you need without CSS I would recommend that path, but don’t completely shy away from CSS in e-mail designs because contrary to popular belief it is supported in most cases.

D. Anchor Links – It is sure that you have to include some links in your HTML newsletter. These could be outbound links to other web pages or links related to your website. Most footers include an unsubscribing link to opt-out from your list how you should handle all these links in your newsletter.
A neat trick is to include both inline color and an additional span tag within the anchor element. If the color and styling of your links are important to the overall design you’ll want to take the extra precaution. I’ve added a small code example below:

some link text

Hover effects are not supported in Outlook 2007/2010, Gmail, iOS or Android. You may still want to include the a:hover style for all supporting clients: Outlook 2000/2003, Hotmail, Apple Mail, and Yahoo! mail, but personally I don’t see much benefit in the partial user experience, since the anchor selectors aren’t heavily supported I recommend just offering 2-3 link colors to use throughout your design.
As a presumption users will also expect your links to open in a new tab or window. Ideally the target=”_blank” attribute should be enough for all browsers to recognize this functionality, and the inclusion of this attribute on your anchor links shouldn’t negatively effect e-mail software such as Lotus Notes, or Outlook either.
E. Always provide a web based view – Readers won’t always be able to view your email natively always offering another version somewhere on the web will give a sense of compatibility.
F. Adding image content :- You’ll want to always set both width and height attributes on your img tags. Without these specifications in order, some clients will distort the image content. An alt tag will also prove useful, so visitors will know what the image content contains before it’s loaded.
The image align=”left” attribute will work much better, or alternatively map out exact table cells to fit your images along the top, left, or right side of your newsletter. You won’t be able to get a perfect match-up with so many clients out there (especially mobile clients), but optimize your images and keep file sizes small for best results.
What content you should write in your newsletter
Make HTML use to create a performing newsletter
Get creative with email subject line
Pic one primary call to action

4 tips for writing good email

Here we are discussing some of best email writing practices which needs to be consider when writing your next business email.

Most of us Judge emails by their subject line whether to read the email or directly delete them all decided by subject line.
Hence subject line is the first impression of your email to your recipients although it is a small part of our email but play a most important role in our email marketing strategy.
Email subject line serve the purpose of our email, what email body contains, and it relates your goal directly with your message. Hence it is a very important part of our whole email that’s why here we are trying to tell you some tips to improve your email subject lines.

  • Keep it short and simple. Subject line should be a maximum of 50 characters
  • Use personalization tokens in subject line it will help to catch their attention. Every one loves the sound of their name. Adding recipient name adds a feeling of a relationship of mutual understanding or trust and agreement between people
  • If you can’t (or don’t want to) use personalization tokens in the subject line, use “you” or “your,” so it still sounds like you’re addressing them directly.
  • The goal behind the email should be clear. when one read your email subject line it should be clear what your email is about.
  • Do not make false promise to increase open rate of your email this will lead irritation in your audience and will lead to a big unsubscribe list.
  • Use A/B testing, split testing with different content in subject line. this will give you a better performing subject line.
  • Most important. How will your viewer benefit from your email ? For example, “Increase your open rates by 60% today” is more appealing than “How to increase open rates.”
  • Make your subject line interesting. For example – “Your order has been received”  is less interesting than “Your new order – 868332 request received ”
  • Use numbers in your subject line. For example “Tips to improve subject line” is less effective than “10 Tips to improve your subject line”
  • Use deadline like “only for today” , “last 10 hours” , this will give a quick hit on your email.
  • Asking a question can also increase user engagement with your email.
  • Make your subject line “Location-specific” for offers related to particular locations only.
  • Make your recipient feel special with creating subject line. Like “Offer For our beloved customers only”
  • Do not use capitalization in email subject line.

Accelerate your ideas