Category Archives: System Engineering

Creating Git-Based Collaboration Repository On cPanel Hosting Or Server

Git is a distributed version control system (VCS) used for tracking changes in the source code during the software development process. It was created by Linus Torvalds in 2005 and has now become one of the most widely used version control system in software development field.

The advantage of Git is that it allows multiple developers to collaborate on a project by keeping track of changes, coordinating work, and providing a historical record of all modifications made to the codebase.

The Sangkrit.net’s cPanel WebhostingWebhosting PlusVPS, and Dedicated Server all offer you a feature called “Git™ Version Control”. This function simply enables you to set up and manage Git repositories for your website’s code. By Git integration in cPanel, website owners and developers can take advantage of version control functionalities directly from the cPanel interface, without the need to access the command line. So this lesson guides you on how you can easily create the Git Repository on your Sangkrit.net hosting option.

Login to your SANGKRIT.net Account, then visit ‘My Products’ page and open the cPanel of the account on which you want to create the Git repository.

  1. On your cPanel account, scroll down to Git Version Control present in the Files section.
  2. Click Create in the top-right corner of the interface and a new interface will appear.
  3. Select whether to clone an existing repository, create a new one, or add an existing one to the list of cPanel-managed repositories.
  4. To clone an existing repository, ensure that the Clone a Repository toggle is enabled. Then, enter the clone URL for the repository that you wish to clone in the Clone URL text box.
  5. To create a new repository or add an existing repository to the list of cPanel-managed repositories, set the Clone a Repository toggle to be disabled.
  6. In the Repository Path text box, enter the path to the directory that will contain the repository.
  7. In the Repository Name text box, enter the desired display name for the repository.
  8. To immediately create another repository, select the Create Another checkbox.
  9. Click Create, or click Return to Repository List to return to the list of repositories.

In the step number five, URL must include the http://https://ssh://, or git:// protocols or use the user@example.com/path format, where user represents the username, example.com represents the domain, and path represents the repository path. Another thing is, you cannot enter a local repository path.

In the step number six, a few important things for you to note down are:

  • If the directory specified doesn’t exist, the system will create it.
  • If the directory already has a repository, the system will add it to the list of cPanel-managed repositories.
  • The function enforces several restrictions on repository paths.
  • Unless you’re adding an existing repository to the list, the directory must be empty.
  • Subdomain directories have a cgi-bin directory and may also contain a .well-known directory. So you must move these before you can create a repository.

Another important thing to know is that if you have entered an SSH clone URL while clicking the Create option, the system will check for the remote server’s public SSH host key. It keeps this key in the /home/user/.ssh/known_hosts file, where user represents your username.

When the remote host is not registered with the system, you will have to click the Save and Continue option to register it to the file. You may optionally click Show Host Identification Information to view the host’s algorithm and SHA-256 and MD5 fingerprints. When the remote host is registered, the system creates the repository and at the time the remote host’s public key is changed, the system displays a warning.

Git has gained its popularity because of its flexibility, speed, and user support for the distributed workflows. It is a very useful tool for software development teams from small to big sizes. It has been commonly used with collaborative software and web development projects. It is also the foundation for many online code hosting systems, such as GitHub, GitLab, and Bitbucket, which provide cloud-based hosting for Git repositories for better collaboration among developers.

Easiest Way To Protect Your Website Resources From Hotlinks & Direct Links

Hotlinks, also called “hotlinking” or “direct linking,” lets a website to show images or other media that are hosted on another server without even uploading the content to its own server.

It is the practice of embedding or linking to media files such as images, videos, etc hosted on a website and linked by another website, without any permission of the owner.

These links use the resources of the website where these files are actually hosted because the hot links display the file without hosting it on their server so the resources of the main server are consumed whenever the webpage containing such files are viewed.

The only positive aspect of hotlink is easy sharing and the negative aspects are bandwidth theft and legal issues. To protect against hotlinking, website owners at Sangkrit.net may simply use hotlink protection on their cPanel WebhostingWebhosting PlusVPS, and Dedicated Server.

Login to your SANGKRIT.net Account, then visit ‘My Products’ page and open the cPanel of the account on which you want to enable the hotlink protection.

  1. On cPanel, scroll down to the ‘Hotlinks’ button and click it.
  2. Click ‘Enable’ and a new interface will open and display the Allowed referrers and Protected extension lists.
  3. Click Go Back.
  4. To allow specific sites to hotlink to your site, add their URLs in the URLs to allow access menu.
  5. To block direct access to files of specific types, add those file extensions to the Block direct access for the following extensions text box.
  6. For example, to block all .jpg images, add .jpg to the Block direct access for the following extensions text box.
  7. When you block these file types, others cannot hotlink to those types of files from your website regardless of any other settings.
  8. To allow visitors access to specific content through the URL, select the Allow direct requests checkbox. For example, if you enable this setting, a visitor could enter http://www.example.com/folder/example.jpg as a URL to access the example.jpg file.
  9. To redirect requests for certain content, enter the URL to which you want to redirect your visitor in the Redirect the request to the following URL text box.
  10. Click ‘Submit’.

You can anytime disable the hotlink protection by clicking the ‘Disable’ button. But as you click Disable, the system will delete the entries in the List of URLs. So it might be better for you to save the list locally before you disable hotlink protection.

Save Website Resources From Potential Misuse Of User Accounts & Unauthorized Access

Leeching occurs when a user of your website shares his login credentials either on a public website or with multiple users in his connection, as a result when multiple users start to access one account in the same timeframe it leads to excessive resource usage, bandwidth overage, security risks, and most importantly the actual risk is the potential misuse of premium memberships sold over the account.

Sangkrit.net cPanel Webhosting, Webhosting Plus, VPS, and Dedicated Server users can easily resolve this issue by enabling the leech protection that helps mitigate such matters by monitoring and limiting the number of IP addresses that can simultaneously access a particular account within a specific time frame.

What Happens When The Leech Protection Is Enabled?
  1. Blocks IP Address: When leech protection is enabled, cPanel tracks the number of IP addresses accessing a specific account within a specified time window.
  2. Exceeding Limit: If the number of IP addresses accessing the account exceeds the configured limit within the designated time frame, cPanel takes action to prevent further access from additional IP addresses.
  3. Blocking Action: Depending on the leech protection settings, cPanel can block access to the account from new IP addresses or redirect them to a specified URL, such as an error page or a page explaining the leech protection policy.
  4. Customization: cPanel allows website administrators to customize the leech protection settings, including the number of allowable IP addresses, the time window for monitoring, and the action taken when the limit is exceeded.
How To Enable Leech Protection On cPanel?

Login to your SANGKRIT.net Account, then visit ‘My Products’ page and open the cPanel of the account on which you want to enable the leech protection.

To enable leech protection for a directory, perform the following steps:

  1. Click Settings, and then select one option from the following:
    • Web Root (public_html or www) — Begin navigation in the document root for the account’s primary domain
    • Document Root — To select the domain that corresponds to the document root in which you wish to begin navigation
  2. Click the Save Changes button
  3. Navigate to the directory that you wish to protect and click the appropriate folder icon to navigate to a different folder
  4. Click the desired folder’s name to select it and a new interface will appear
  5. Enter the maximum number of logins that you wish to allow each user within a two-hour period or such
  6. Enter a URL to which you wish to redirect users who exceed the maximum number of logins within a two-hour period
  7. You may select the Send Email Alert To checkbox and enter the email address to get an alert when Leech Protection activates.
  8. For disabling any account that exceeds the maximum number of logins, simply select the Disable Compromised Accounts checkbox
  9. Click Enable and that’s it

For adding, editing, and deleting the users, you simply need to navigate to a directory that you wish to protect with user-level protection and then click Manage Users to navigate to cPanel’s Directory Privacy interface (cPanel -> Home -> Security -> Directory Privacy) of that folder.

You may disable the leech protection anytime by navigating to the directory where you want to disable it and then simply click the Disable button.

Leech protection helps you maintain the security and stability of your website by preventing excessive resource consumption and potential misuse of accounts. This protection is very useful for websites that are offering restricted content, paid content, membership option, or have any similar scenario where sharing the login credentials could lead to unauthorized access.

Improving The Security & Performance Of Your Websites With Functional Isolation

Security is not an absolute thing, it is a continuous process. Adding an SSL certificate and Website Security to your website is an important thing to do but in addition to that, your server must be configured in a way to reduce the damage that happens when your website is hacked.

Implementing Functional Isolation

A logical separation of websites should be implemented into separate hosting accounts having their own access. In the case of applications, you should avoid installing and testing multiple applications in one directory.

If you own a server, simply create multiple hosting packages separately for important websites so if in case anytime your website is hacked, the malware should stay limited to that particular hosting account of your website and other sites remain unaffected. This is called functional isolation. It is important because malware files are coded in a way to get automatically copied to various directories on your hosting account.

How to do logical separation of websites?

Linux is a multiuser operation system and your server (both VPS & Dedicated Server) offers you the feature to create multiple hosting accounts with separate cPanel logins. You can decide the limitation for each hosting account on your server.

Simply start by logging into your Sangkrit.net account then open the WHM of your server. On the WHM dashboard, you can create separate cPanel hostings from the Packages -> Add a Package option.

Most people understand the need of protecting their websites and keeping regular backups only after they face data loss after some malware or hacking of their website. Avoid being that person.

Saving Your Website From Distributed Denial-of-Service (DDoS) Attack

DDoS i.e. Distributed Denial-of-Service attacks are attempts by hackers to make any online service down by sending a flood of traffic that the host cannot handle at the time.

The Tagets of DDoS Attack

In the past, big companies and large websites were only its targets but nowadays even small business websites come with the issue of DDoS attacks occurring on their websites.

What DDoS attack does to your web service?

The only good thing is no data loss occurs during a DDoS attack, all it does is makes the service unavailable to users. It is not done by an individual hacker sitting on a system instead the attacker directs hundreds to thousands of zombie host systems against its target. These hosts are drafted from a million unprotected devices through high-bandwidth connections. The attacker builds a legion of such zombie hosts and then they wait for the command to attack any service.

The result of the DDoS attack

The result of such an attack is the denial of the service, loss of revenue as well as reputation because the end user may find the service less reliable as it goes frequently down.

How to find out you have been attacked with DDoS?

The first sign is the service becomes unavailable to users but that can also happen due to your success with legitimate traffic especially when you choose to host your website on a shared hosting plan and not on a Cloud or Dedicated Server.

Other signs include slow or denied access to your web service for days rather than a spike of seconds or minutes. You may check whether any single IP address is generating a large number of requests. Check your server’s log file to see if any flood of traffic is being generated from suspicious sources or the TTL i.e. time to live on a ping request times out frequently.

How to protect yourself from DDoS attacks?

The advanced, as well as the premium plan of Website Security at Sangkrit.net, offers you DDoS protection which you can easily set up on your own after subscribing to it.

It also offers you CDN i.e. Content Delivery Network that disburdens the load on a single server to many remote servers so that when traffic comes to your website it can be routed to the geographically closest CDN server.

Real success is no different than a DDoS attack

Choose a Dedicated Server to host your website because real success is no different than a DDoS attack.

To find out whether the increase in traffic is actually a DDoS or not you would need to know how to distinguish between good and bad traffic. Otherwise, you might lose traffic from legitimate visitors. A few key points we have discussed above such as single IP generating too many requests can be a DDoS attack, etc.

You may also take help by appointing a system administrator to look after your website or you may subscribe to online support (available at per hour per terminal cost) simply by sending an email to the system at Sangkrit.net.

What Your System Administrator Cannot Do To Your Domains & Server?

As you have already learned that the system at Sangkrit.net allows you to assign a system administrator to manage your website and server. It also enables you to control his access and assign limitations.

But despite the permissions you have granted to him, for your account’s safety, there are some things that he cannot do to your account.

Your system administrator can purchase products (if you have granted his permission for that) using the payment method you have provided him or added to your account but he can never manage or add new payment methods to your account.

He cannot invite any helper to access your account or reach the online support team of Sangrkit.net specifically for your account. He cannot view or change your support PIN or password.

Your system administrator cannot view your order history or upgrade or downgrade your products but he can purchase and renew products if you have granted him specific permissions for that.

To get a system administrator to help you to manage your website, apps, and server you can simply email the system at Sangkrit.net.

Controlling The Access Of System Administrator Who Manages Your Website & Server

The system at Sangkrit.net empowers you to assign a system administrator to manage your website and server. It also enables you to set his access level i.e. add limitations to what he can and cannot do in your account.

While adding a manager the time you send invites, the system shows you an option to choose his access level. The level can be of the following types:

Products, Domains & Purchase

This level of permission allows your system administrator to purchase products on your behalf using the payment method you have added. He can access your products and cancel subscriptions over purchased products.

For domain names, you can set the specific permission that you will learn in the next coming lessons.

Products & Domain Names

The system administrator can access, and manage your products and can also cancel new products. For domain names as in the above-mentioned level of permissions, you can set your specific permissions.

Domain Names

This level of access only enables your system administrator to manage your domain names and transfer. You can also assign a set level of permissions over your domains.

Account Actions

This set of permissions allows your system administrator to access your account at some point in time you say but currently, no access to products and no purchase is given. This level simply allows you to keep your system administrator in connection so that you can assign tasks to him in the future.

To find a system administrator to manage your website, apps, and server you can simply send an email to the system at Sangrkit.net.

How To Assign A System Administrator To Manage Your Website & Server?

When you subscribe to a Webhosting, Cloud, VPS, or Dedicated Server at Sangkrit.net, the system provides you with an option to assign someone as your programmer or system administrator to work on your behalf on your websites, without accessing your private information or anything you need to keep private.

When do you need a Manager?

The fully managed dedicated servers offer you complete support. The Managed WordPress and Website Builders are so easy that you can do everything on your own. But still, if you want a manager to look after your product, design your website, or manage your WHM-cPanel-less server from the command line then you can subscribe to the online support by sending an email to the system at Sangkrit.net.

You can invite your programmer to work as your system administrator and look after your products. Such as opening and using your products, creating website, editing code on your behalf without viewing or changing your personal account information like your payment method and password.

How to add a System Administrator?

  1. Login to your Sangkrit.net account and visit this page here.
  2. Select ‘Invite to Access’ from the people who can access my account section
  3. Enter the Name and Email address of the programmer you’re inviting
  4. Select an access level to make sure how much access you are providing him, you may read the explanation of access levels to know more about each level of access
  5. Select Invite and the system will send an email invitation to the person you are providing access to your account
  6. Once the person accepts your invitation, the system will let you know and he would be able to manage your products

How to cancel an invitation?

All pending invitations can be canceled by either you or an existing delegate by selecting the cancel option. The invitations which are not accepted within 48 to 72 hours will expire automatically.

How to remove a system administrator?

You can cancel the access anytime by logging in to your Sangkrit.net account and visiting the same page here.

Then from the people who can access my account section, select the ‘Edit’ option visible next to the name of the delegate you want to remove, now click the ‘Delete’ option visible under the ‘Save’ button.

The person you are assigning your manager must have a Sangkrit.net account in order to accept your invitation. In case they don’t have one, the system automatically prompts them to create one.

Server Management Made Easy & Affordable At Sangkrit.net

A dedicated server is like your own computing machine. It is easy to use if you know how to. In olden times when people use to host a large website with heavy traffic, they use to spend thousands of dollars in setting up their own server.

Time changed and those bare metal servers came up with lease and subscription options so that anyone can subscribe to them online and host his domains.

That has made things easier, as you get a control panel such as Plesk or cPanel WHM and that can make the server manageable for everyone but not always as there are times when you get stuck in something and you only have the command line to resolve the issue. Here, Fully Managed Dedicated Server and Webhosting Plus save you from facing such issues.

Fully Managed Dedicated Servers

You won’t face such problems in Sangkrit.net because here you can subscribe Fully Managed Dedicated Server option offering you round-the-clock online support from the experts. And to make things even simpler for everyone the Webhosting Plus option is now available with a super easy control panel.

Webhosting Plus

The Webhosting Plus offers you the speed of a server accessible to you with a simple control panel as you get on a shared hosting option. This hosting is an ideal option for users who don’t have good tech skills or cannot afford a fully managed dedicated server.

This is a powerful hosting and all its plans include a one-click install option so that you can simp,y install WordPress on any domain of yours to start a business or eCommerce website. Its simple backup and restore option allows you to upload or transfer your website. Uptime is just like a server, 99.9%. Security monitoring is 24/7, SSL is free and you can easily set it up to work. You also get the benefit of daily backups to keep files and content of your website safe.

Overall Webhosting Plus is for those who don’t have any idea on how to work with servers, whose budget is limited but at the same time need a powerful hosting option.

Using The Upgraded Hostnames On Your Sangkrit.net Server

The hostnames will upgrade shortly so if you are still using legacy hostnames you will need to update them to the new format i.e. the reversal of the IP octets.

You can update the hostname for your VPS or Dedicated Server. You can do that simply by logging into your Sangkrit.net account and then following these steps:

  1. Visit your ‘My Products’ page
  2. Select ‘Servers’
  3. Next to your server click select ‘Manage’ 
  4. Select the ‘Settings’ option next to the ‘Dashboard’ section, the default page
  5. From the Server section click Change which is next to Hostname
  6. Now type or paste the new hostname in the Server Hostname field,
  7. Select Save

The hostname should meet the requirements, the server tests the hostname, and then only it accepts to save it. After you have successfully saved all the changes, the new hostname will appear in the Settings section.

Configuring One Server To Handle HTTP & HTTPS Respectively

On an Nginx server, it is possible for you to configure it to manage both HTTP and HTTPS requests.

You should also know that prior to 0.7.14, it was not possible to enable SSL certificate selectively over individual listening sockets, as we have done here in the following given code:

server {
    listen              80;
    listen              443 ssl;
    server_name         www.yoursite.com;
    ssl_certificate     www.yoursite.com.crt;
    ssl_certificate_key www.yoursite.com.key;
    ...
}

Before SSL could only be enabled over the entire server using an SSL directive, thus it was impossible to put up a single HTTP/HTTPS server. Afterward, the SSL parameter of the listen directive was added to resolve this problem.

The use of the SSL directive in newer versions has been discouraged.

When Multiple HTTPS Servers Listen On A Single IP Address

In SSL protocol conduct, a typical problem occurs when two or more configured HTTPS servers listen on a single IP address.

server {
    listen          443 ssl;
    server_name     www.yoursite.com;
    ssl_certificate www.yoursite.com.crt;
    ...
}

server {
    listen          443 ssl;
    server_name     www.yoursite.org;
    ssl_certificate www.yoursite.org.crt;
    ...
}

As shown above, what exactly happens here is that the client browser starts to receive the default server’s certificate (www.yoursite.com) regardless of the name of the server requested.

This is pushed by SSL protocol conduct. Here, the connection via SSL is made before the browser sends another HTTP request and Nginx does not know the server name requested. Hence, it may only offer the default server’s certificate.

Here’s the solution:

server {
    listen          192.168.1.1:443 ssl;
    server_name     www.yoursite.com;
    ssl_certificate www.yoursite.com.crt;
    ...
}

server {
    listen          192.168.1.2:443 ssl;
    server_name     www.yoursite.org;
    ssl_certificate www.yoursite.org.crt;
    ...
}

Above given is the ancientest and most powerful way used for resolving this issue. Here a separate IP address is assigned for each HTTPS server.

Updating Nginx Server Configuration To Use The SSL You Have Purchased

You need to update the config file on your server to use the SSL certificate you are subscribed to. This can be done by accessing the command line SSH and opening the Nginx config file for the domain you are installing the SSL certificate.

Simply run the following command:

sudo vim /etc/nginx/sites-available/yourwebsite.com

Now update the config file to use the SSL certificate:

server {
        listen 80;
        server_name yourwebsite.com;
        return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;

    server_name yourwebsite.com;
    ssl_certificate     /etc/nginx/ssl/yourwebsite.crt;
    ssl_certificate_key /etc/nginx/ssl/yourwebsite.key;

    root /usr/share/nginx/yourwebsite.com/;
    index index.php  index.html index.htm;

}

The next step is to save the file using this command:

wq!

And then restart your Nginx server with this command:

sudo service nginx restart

That’s it.

Configuring SSL & Intermediate Certificates On Nginx Server

In the previous lesson, you learned about installing and configuring Nginx on your dedicated server. Now this lesson is on installing SSL and other standard certificates.

The first thing you need to do is get an SSL certificate from Sangkrit.net, once you subscribe to it and your certificate request is approved just download it to install those files on your dedicated server.

To download and install your certificate files follow these steps:

  1. Visit your Sangkrit.net product page
  2. Select SSL Certificates
  3. Select Manage next to the certificate you need to download
  4. Select a Server type
  5. Click the Download Zip File option
  6. Your certificate would start downloading now.
  7. Copy the SSL certificate file and the certificate bundle file to the Nginx server
  8. You already have a key file on the server which you got when you generated your certificate request.
  9. Now edit your Nginx configuration to reference these files

Your certificate is installed now. Remember, the actual configuration file you edit depends on your version of Nginx, your OS platform, or the method you are using to install Nginx.

Installing & Configuring Nginx On Your Dedicated Server

Nginx is a web server that is also used as a reverse proxy option. It also balances the load on your dedicated server and acts as a mail proxy as well as an HTTP cache. It is software used for high performance on your server.

This lesson will guide you in installing and configuring Nginx and for that, you are going to need the root privileges. You will also require to set up your CentOS server to use the EPEL Repository which stands for Extra Packages for Enterprise Linux.

To install EPEL simply run this command:

sudo yum install epel-release

You can read more about its configuration steps here. Earlier we installed yum as a package manager but it does not include any new version of Nginx in its default repository so installing EPEL will make sure that Nginx on CentOS remains up to date.

You are ready to install Nginx

Now you are ready to install Nginx on your server, simply run the following command:

sudo yum install nginx

Next, start Nginx:

Nginx doesn’t start on its own, so you will need to run a command for starting Nginx on your server:

sudo /etc/init.d/nginx start

To make sure Nginx is properly installed on your server, just direct your browser to your server’s IP address. If you see the words, “Welcome to Nginx”, it means you have Nginx installed and working.

Executing Sofware Packages On Your Dedicated Server With YUM

The package management or software installations on your CentOS-based Linux server can be performed in two different ways, the first is via using a graphical user interface while the other is via command line terminal. The GUI is ok but YUM is a lot more powerful tool globally used by most system administrators.

YUM is one tool made available a long way for managing packages on CentOS Linux systems. One advantage of YUM is it not only keeps track of outdated packages but also monitors outdated dependencies on your server.

Running yum check-update

By running yum check-update command on your server you can check packages that can update candidates. If you have subscribed to a new dedicated server, running this command is going to install the updated candidates on your system.

Installing updated candidates with yum update

Another command called yum update will install all updated candidates on your system, this might take some time to complete depending upon the size of the installation and the speed of your server.

Now you are ready to install software packages

Once these things are done, you are ready to install any software from a central repository with YUM.

Similarly, the list all command of YUM will list all currently available packages, the list installed command shows the packages which are installed using YUM, and the install command is used for installing any package, whereas remove command first removes and then installs a package.

There are many more commands that you will learn about while working on your server. The man yum command is going to provide you with the help file showing all important information.

Installing & Configuring Apache On Your Dedicated Server

Before installing PHP or MySQL, the first thing you need to do is install Apache on your dedicated server. In order to do that you simply need to access the command line of your server and log in as the root user:

  1. Connect your server via SSH
  2. Run this command: sudo su –
  3. Enter your server password

You now have root access.

Once you have that, you can install Apache using the ‘Yum‘ command:

[root@admin]# yum install httpd
Loaded plugins: fastestmirror, langpacks
base
| 3.6 kB 00:00:00
extras
| 3.4 kB 00:00:00
updates
| 3.4 kB 00:00:00
extras/7/x86_64/primary_d
| 121 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirror.sigmanet.com
* extras: linux.mirrors.es.net
* updates: mirror.eboundhost.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-45.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-45.el7.centos for package:
httpd-2.4.6-45.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.645.el7.centos.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-45.el7.centos will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution
Installed:
httpd.x86_64 0:2.4.6-45.el7.centos

Dependency Installed:
httpd-tools.x86_64 0:2.4.6-45.el7.centos
mailcap.noarch 0:2.1.41-2.el7

Complete!
[root@admin]#

Once Apache is installed, the next thing you need to do is configure it and then make sure it works on your server, use the following command:

[root@admin]# systemctl start httpd && systemctl enable httpd

To make sure the Apache services are running on your server:

[root@admin] sudo systemctl status httpd

This will show you an active status if the service is running on your dedicated server.

Verifying The Presence Of Required PHP Libraries On Your Dedicated Server

In the previous lesson, you have learned about getting yourself to know whether the Memcached service on your server is installed and listening to Port 11211.

Now this lesson is on checking the presence of the required PHP libraries needed to make Memcached work for you.

You can verify the installation from SSH. Another important thing is to make sure to use the same version of PHP as the website you want to use Memcached on.

On a dedicated server having WHM/cPanel with PHP version 7.3, the following command is used with the output as shown:

[root@server[~]: ea-php73 -i | grep "memcached" /opt/cpanel/ea-php73/root/etc/php.d/memcached.ini,
memcached
memcached support => enabled

Verifying Memcached service & PHP libraries are working

From the command line, telnet to the Memcached service.

[root@server ~]# telnet localhost 11211

This output will be returned, and you will be connected to the Memcached service.

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Enter the command stats. A full page of output will appear, but towards the middle, look for the lines STAT bytes_read and STAT bytes_written.

stats
STAT pid 6374
STAT uptime 37567
...
...
STAT bytes_read 3733268975
STAT bytes_written 6526192728
STAT limit_maxbytes 1073741824
...
...
END

When you see a big amount of data is read and written, that means Memcached is working.

Entering the command stats again is going to show changes to these values.

And when you are seeing a very tiny amount of data read and written, or the values of 0, that means Memcached is not functioning good.

stats
STAT pid 30601
STAT uptime 603941
...
...
STAT bytes_read 7
STAT bytes_written 0
STAT limit_maxbytes 1073741824
...
...
END

Use quit to return to a standard prompt.

quit
Connection closed by foreign host.
[root@server ~]#

So that is how you can know that the caching is working as expected.

Know Whether Your Server’s Memcached Service Is Listening On Port 11211

If you’re not sure whether your dedicated server‘s Memcached service is listening on port 11211 i.e. it is installed and running properly, there are some easy tests you can do to make sure everything is operating fine.

Before you start, enable the administrator access on your server (in case you have not), connect via SSH then switch to the root user.

Next, in the command line, type the following command and PRESS ENTER:

telnet localhost 11211

This will report to you back that it was able to connect to the service.

[root@server[~]: telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

In case, if it’s not installed properly, you will see something like this:

[root@transfer[~]: telnet localhost 11211
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

And you will not be able to connect to the service.

In the next lesson, you will learn about testing the presence of the needed PHP libraries to make Memcached work for you.

Configured Memcached PHP Libraries On Your Server, Next What?

In the previous lessons, you have learned about installing Memcached PHP Libraries and configuring Memcached Daemon on your dedicated server. Now next steps are to configure your apps and websites to use them so that you can get their real benefit.

So once you get the Memcached Daemon and PHP libraries installed on your CentOS-based dedicated server, you are required to configure your PHP application to use Memcached. In case you don’t it, Memcached is going to use your server resources without providing you any of the advantages.

Before starting, the system recommends you take a backup of your websites and then follow the changes outlined below.

WordPress users can take its benefit simply by using a plugin called W3 Total Cache Plugin. Yes, there are many other plugins as well but the system finds it best for most of its users. If in case this plugin doesn’t suit you or it is in conflict with some other plugin you are using, it that’s your case then you can choose some other plugin such as Batcache, Cachify, Memcached-Redux, etc.

In this lesson, you will learn about configuring the first and the best one i.e. W3 Total Cache. Simply start by installing-activating the plugin and then to configure, navigate to the Performance -> General Settings page.

Next, make sure the Enable tickbox is checked and Memcached is selected with the cache method for:

  • Page Cache
  • Object Cache
  • Database Cache
  • Fragment Cache

Once you do this, your website starts to use the Memcached services for imporving the performace of your website at the same time reducing the load on your dedicated server.

How Memcached Daemon Works On Your Dedicated Server?

The loading of files and code on your dedicated server take lots of its resources, this resource usage can be reduced by using an object caching system and when you do that, the performance of your server automatically increases. This happens because then your server needs fewer resources to run web applications.

Memcached is a free high-performance, distributed memory object caching system which is generic in nature. It is planned for speeding up dynamic web applications simply by alleviating your database load.

Earlier you learned about configuring the Memcached PHP Libraries on your dedicated server. Now this lesson will let you know what is Memcached and how you can easily install it on your CentOS-based dedicated server at Sangkrit.net.

On CentOS servers, installation of the Memcached daemon is performed via command line and it is freed of any control panel you may be using such as WHM or cPanel, etc.

How this all works for you?

The cache data is simply stored in the hardware units such as RAM and that can also be used in correlation with a software segment.

As we have explained before, the primary purpose of cache is to increase the retrival of information stored in the form of data by minimizing the requirment to access the lower layers of storage every time a new request is made by the client.

Yes, this data is not the actual data stored on your server but it is a subset of data copied from the databases having the real data fed by your application.

This is like when you keep actual notes in your diary or anywhere else but you remember those notes anyway in your mind. So when the time comes when you need those notes; Instead of opening your diary again and finding them you directly make use of them because you already remember them anyway.

Hence, the main advantage of caching is to speed up loading and minimize the system resource usage that is generally needed to load any request such as a web page of your website or application.