Archive

[Solved] HTTP Error 503. The service is unavailable

HTTP Error 503. The service is unavailable

Web servers such as LiteSpeed and Apache use various codes to tell browsers about responses. For example, if the web server replies back with HTTP code 200, it means that everything is fine and the response generation was successful. There are many other response codes, but today we will discuss HTTP Error 503, and when this usually happens you get following error on your browser: HTTP Error 503. The service is unavailable.

 

If you are not the administrator of the site, there is nothing much you can do as mostly this error indicates that there is something wrong on the server side. You can either refresh the page, visit later or better notify an administrator of the site. However, if you are the administrator of the site, you can do much to figure out what is wrong and there are various reasons and ways to fix this error. There are multiple web servers, each may give you a slightly different error message, such as:

 

  1. 503 Error
  2. Http/1.1 Service Unavailable
  3. 503 Service Temporarily Available
  4. 503 Service Unavailable
  5. HTTP Error 503
  6. Service Unavailable – DNS Failure
  7. Error 503 Service Unavailable

 

Usually, the main thing to look for is error code which is HTTP error code 503. Today we will see how we can discuss various reasons and respective ways to fix the issue.

 

Server Side Issue

 

Before deep diving into various reasons as to why this could happen, I would again like to mention that this is a server side issue. All errors in the 5xx range are considered errors on the server side including 503 Service Unavailable Error. However do keep in mind that 503 error means the server was able to process your web request and it was functioning properly but it chooses to return 503 error code because due to some problem/issue server is not able to process this request the way it should have.

 


Refresh the page

 

Some times you will get the following error

 

503 Service Unavailable – The server is temporarily busy, try again later!

 

 

 

It may really be a temporary error as the error message says, so wait some time and refresh the page. This can happen to high traffic sites, where enough resources are not available to handle the request. On the user end, be careful if you are seeing this error on the payment related pages, and make sure you won’t get charged twice.


Using our Apache as Backend Feature

 

If you are our customer and using our Apache as Backend feature, there is a chance that Apache is down. In this case frontend server which is OpenLiteSpeed, will give you 503 error, as it is failed to connect to Apache. See if Apache is running

 

systemctl status httpd

 

If Apache service is not running, you can start with

 

systemctl start httpd

 

And see if your issue is resolved.

 

PHP FPM is down

 

If you get something like (Assuming you are using our Apache as backend feature or your stack includes PHP-FPM)

 

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

 

This means your PHP-FPM service is down. You can start php-fpm using

 

systemctl start php-fpm

 

In case you are our customer, there are multiple PHP-FPMs are available for different PHP versions and their respective commands are:

 

systemctl start php54-php-fpm

systemctl start php55-php-fpm

systemctl start php56-php-fpm

systemctl start php70-php-fpm

systemctl start php71-php-fpm

systemctl start php72-php-fpm

systemctl start php73-php-fpm

 


Check various log files

 

If your issues are still not resolved, you can start to check various log files. In the case of CyberPanel and LiteSpeed (OpenLiteSpeed), log files to check are:

 

/usr/local/lsws/logs/error.log

/usr/local/lsws/logs/stderr.log

 

In the case of Apache

 

/etc/httpd/logs/error_log

 

You can do an efficient search of log files using the grep command such as:

 

cat log_file_path | grep error

cat log_file_path | grep notice

 

This command will make sure that you only get the most relevant information, otherwise, you may also get info level messages in your log files and they are not relevant in this case.


503 Errors due to PHP Malfunction

 

Most of the times 503 errors can come due to a problem in your PHP code, or either PHP-FPM/LSPHP are not able to produce response thus server started giving you 503 error. It is always recommended to first create a phpinfo page and see if your PHP side is working fine. If you can see the phpinfo page, you can move forward to further debug the cause, otherwise, make sure LSPHP is working fine and external application is created properly or PHP-FPM is up and running.

 

Disable PHP OPCode Caching (xCache, ACP or eAccelerator)

 

On a default install of CyberPanel (OpenLiteSpeed or LiteSpeed Enterprise), OPCode caching is enabled. Sometimes different sorts of opcode caching can have compatibility issues with LSPHP (PHP). So if you are getting HTTP Error 503 Error better try to disable opcode caching. On CyberPanel you first need to find out which PHP version is used by your site. To find out your PHP version on CyberPanel run the following command

 

cat /usr/local/lsws/conf/vhosts/yourdomain.com/vhost.conf | grep php

 

For example, the PHP version of your site is 7.2. Go to the configurations directory of PHP 7.2 and disable opcode caching.

 

cd /usr/local/lsws/lsphp72/etc/php.d

mv 10-opcache.ini 10-opcache.ini.bak

systemctl restart lsws

or

/usr/local/lsws/bin/lswsctrl restart

 

This will disable OPCode caching. If you are not on CyberPanel, you need to find the php.ini file for your PHP and disable OPCode caching. Usually, php.ini location is disclosed in phpinfo page. If your issue is still not resolved, you can move on to the next step.

No space left on /tmp

 

Some web application use /tmp directory to store temporary files (session data etc). If /tmp is full you can get HTTP Error 503 Error. Use the following commands to inspect /tmp directory space

 

df -h

df -i

 

 

PHP memory_limit reached

 

memory_limit is a php directive that specifies how much memory a PHP script is allowed to allocate. Sometimes your application might be exceeding this limit, thus failed to produce response for the web server resulting in HTTP Error 503 Error. As explained above, first find out the PHP version used by your site. Then you can directly increase memory_limit from CyberPanel interface.

 

Login to your CyberPanel Dashboard then from left sidebar PHP -> Edit PHP Configs

 

 

  1. Select PHP version to change the value of memory_limit directive.
  2. Set the new value of the directive.

 

Finally, scroll down and click Save Changes.

 

max_execution_time reached

 

max_execution_time is similar to memory_limit. So if your PHP script exits early without producing response again you will get the same error. You can follow the same procedure as described above to fix max_execution_time as well. Make sure to set it to a high enough value so that your script is properly executed.


Conclusion

 

We’ve pretty much discussed all the possible causes of “HTTP Error 503. The service is unavailable”. However we recommend moving your sites to CyberPanel, because CyberPanel use LiteSpeed servers. Which means in low cost VPS you can host more sites, and using LSCache WordPress plugin you can avoid many such errors including HTTP Error 503. Because if your pages are cached, PHP engine is not used, thus giving other applications more resources to run. So in a low cost server you can run multiple sites at super fast speed and avoid such errors. You can learn in our OpenLiteSpeed vs NGINX comparision post as to why you would use CyberPanel and OpenLiteSpeed.

 

You can also get our managed vps and let us do this for you. We offer 3 days trial (no credit card required, plus free migration and fully managed support)

cPanel Alternative: CyberPanel! Hosting Control Panel for LiteSpeed

cPanel has been around for ages, there are many people using cPanel but due to its cost, they are always looking for cPanel alternative. There are hundreds of cPanel alternatives out there but today we will talk about CyberPanel. CyberPanel not only is a great cpanel alternative, but it is super fast as well. Sites running on CyberPanel are fast, as CyberPanel use OpenLiteSpeed as a server in the free version and LiteSpeed Enterprise Web Server in the paid version.

 

CyberPanel is super easy to use due to its user-friendly GUI (Graphical User Interface). According to current users, the learning curve is not very hard when they shift to CyberPanel. CyberPanel have 2 variants, one is free and other is paid. We will first learn the difference below.

 

CyberPanel for free

 

The free variant of CyberPanel comes with OpenLiteSpeed. Apart from that, it is 100% the same as the paid version of CyberPanel except for the containerization feature. However, if you are using CyberPanel for personal use, containerization feature does not make sense to you.

 

CyberPanel paid or CyberPanel Enterprise

 

The paid version of CyberPanel comes with LiteSpeed Enterprise Web Server. At the time of this writing, there are only a few differences between OpenLiteSpeed and LiteSpeed Enterprise. Let’s discuss them below:

 

  1. LiteSpeed Enterprise have ESI (hole punching)
  2. QUIC (QUIC is planned to be included in OpenLiteSpeed as well)
  3. Full .htaccess support, whereas OpenLiteSpeed also have support for .htaccess but it is limited to certain features.

 

If you want to learn other differences in details you can visit here.


What should I choose, CyberPanel or CyberPanel Enterprise?

 

Now there comes a great question. How can I determine as to what server I need?

 

You are good with OpenLiteSpeed, if:

 

  1. You just have a normal WordPress blog.
  2. WordPress blog with WooCommerce but you don’t use ESI.
  3. Forum scripts like Vanilla or other forums scripts that do not rely heavily on the .htaccess file.
  4. Drupal-based sites.
  5. Joomla Based sites.

 

Or any other sites that don’t heavily rely on .htaccess files and don’t require ESI feature.

 

You will definitely need LiteSpeed Enterprise, if:

 

  1. If you are using ESI hole punching on WordPress, mostly needed with WooCommerce stores and shopping sites.
  2. Magento and Prestashop stores as their cache plugins require ESI.
  3. And apart from that, almost everything is compatible with LiteSpeed Enterprise.

Features that come with CyberPanel

 

Let’s list out some major features that come with CyberPanel.

 

  1. OpenLiteSpeed or LiteSpeed Enterprise Web server (Apache can be used as backend through our platform)
  2. Mail Server (Postfix/Dovecot/Rainloop)
  3. Email Marketing Tool Kit.
  4. Security via FirewallD and SSH Hardeing options.
  5. FTP Server
  6. DNS Server
  7. Docker Manager
  8. Containrization. (Also available via our platform)
  9. Email Limits

 

All these features are available via just one install command, we will see how we can install and use CyberPanel as a cpanel alternative in this tutorial.


Step 1: Get your self a VPS

 

The first step is to get yourself unmanaged or managed vps with CyberPanel. Our platform is specifically designed to interact with CyberPanel. So CyberPanel is automatically installed and is ready to use for you.

 

 

Once your VPS is ready login to your platform account.

 

  1. From left sidebar click Services.
  2. Then click Manage on your recently ordered service.

 

 

Now click Manage CyberPanel and it will take you to the page, where you can remotely manage CyberPanel through our platform giving you many extra features. We are further going to discuss additional points in our next steps.


Step 2: Update DNS for your domain

 

Before moving on to creating your website, we will first make sure that DNS records are properly set. Since our domain is registered at NameCheap we will demonstrate through it. However for other domain registrars it is pretty much similar. Login to your NameCheap account. In your NameCheap dashboard you will see list of your registered domains such as:

 

 

Click Manage for the domain you are going to use, in this example we are using cyberhosting.org.

 

 

After clicking Manage, click Advanced DNS, and create your first nameserver.

 

Here 192.168.100.1 will be IP of your server make sure to replace it with the IP of your server and finally click done. This will create the following nameserver

 

ns1.yourdomain.com -> 192.168.100.1

 

Similarly, create a second nameserver such as ns2.yourdomain.com

 

 

  1. Click Domain from the top menu again, it will take you to the main dashboard for the domain.
  2. From drop down select Custom DNS and enter nameservers you just created above.
  3. Finally, click the Tick Mark.

 

Once all of these steps are done, you are ready to create your first website through our platform. However, if you don’t want to go into the hassle of registering private nameserver you can skip everything above and set up your dns on CloudFlare using this guide. With CloudFlare all you have to do is set their provided nameservers and then add A records in their dashboard, you can also turn on CloudFlare proxy for speed improvements, but it is the topic of another day.


Step 3: Create Website in CyberPanel

 

After clicking Manage CyberPanel from the last step you will land on a page that will look like:

 

 

Click Create Website, so that it can take you to create a website page.

 

 

Fill the Create Website form and click Create Website. Please note that you can also check SSL and Apache as Back End option. Learn more about Apache as Back End option for SSL option to work make sure your DNS records for the domain is already updated as discussed in the step above. Once the website is created, we can move on to further important settings like creating an FTP account or database for your application.


Step 4: Creating an FTP Account

 

 

Once the website is created, click on your service ID. You will be brought back to the page where you can manage your sites created in the CyberPanel.

 

 

Click the launch icon.

 

 

From the left sidebar, click Create FTP Account under FTP. Fill in all the details and click Create FTP button. You can leave the path empty and default path will be used which is usually document root of the website (i.e. /home/domain.com). But if you set some path such as helloworld the final path will be relative to document root such as /home/domain.com/public_html/helloworld.

 

FTP Account is necessary to upload your website/application files. But if you are going to use our Auto Installer creating FTP account is not really necessary.


Step 5: Creating a Database Account

 

 

If you followed our previous step you are already on the page from where you can click Create Database from the left sidebar, if not, you can click Server ID from top, launch the website and then you will land on the page where you are able to create a database for websites.

 

Fill in all the details and click Create Database. However as discussed in the last step, if you have used our Auto Installer, it will also take care of database creation, so you need not create a database as well.


Step 6: Backup Strategy

 

Until now you can guess how easy it is to use CyberPanel which makes it a great cPanel alternative. However, without a proper backup strategy, you can’t have a good night sleep. Our platform provides you various automatic ways to configure daily/weekly backups. You can configure daily/weekly backups to following storage services:

 

  1. AWS S3 (You can sign with AWS to get 5GB space for free)
  2. DigitalOcean Spaces
  3. Or self hosted S3 Compatible MINIO Storage.

 

 

Configure Backups to AWS S3

 

 

Login to our dashboard and go to services and select the service on which you want to configure backups. And click Manage CyberPanel.

 

On this page scroll down and click S3 Backups. Which will land you on this page:

 

 

First, you need to connect your AWS account. You can create a separate user through Amazon IAM Console. More detailed instructions are available here. Make sure you give that user programmatic access and access to S3 related operations in your account. Finally, click Connect Account.

 

From the left sidebar, click Create Backup Plan. So that you can finally send backups to AWS S3. Before creating a plan make sure you have created a new bucket in AWS S3 as you need to select a bucket to send backups to. On the create plan page you will be asked for:

 

  1. Plan Name – Plan names are used to identify backup plans when they are sent to AWS S3 Buckets
  2. AWS S3 Bucket: AWS S3 Bucket that will be used to store backups
  3. Frequency: How often the backup will be generated and sent (Daily/Weekly)
  4. Finally select domains that you want to include in the backup plan.

 

Once all of these are configured, just click Create Plan. You can also force run a backup at any point or view backups log right through our platform.

 

Configure backups to DigitalOcean Spaces

 

 

Login to our dashboard and go to services and select the service on which you want to configure backups. And click Manage CyberPanel.

 

On this page scroll down and click DO Backups. Which will land you on this page:

 

 

First, you need to connect your DigitalOcean account. Credentials can be configured in your DigitalOcean Apps & API section. Finally, click Connect Account. Once connected, the page will refresh and gives you confirmation that your account is successfully connected.

 

From the left sidebar, click Create Backup Plan. So that you can finally send backups to DigitalOcean Spaces. Before creating a plan make sure you have created a new Space as you need to select space to send backups to. On the create plan page you will be asked for:

 

  1. Plan Name – Plan names are used to identify backup plans when they are sent to DigitalOcean spaces
  2. Region: Select the region where you have created a space to store backups
  3. DO Bucket: DO Bucket/Space that will be used to store backups
  4. Frequency: How often the backup will be generated and sent (Daily/Weekly)
  5. Finally, select domains that you want to include in the backup plan.

 

Once all of these are configured, just click Create Plan. You can also force run a backup at any point or view backups log right through our platform.


Conclusion

 

We’ve discussed almost every angle that is needed to run a basic or advanced site. From creating a website to creating a database and finally choosing the backup strategy we did it all. As you can see it is super easy and convenient which make CyberPanel a great cPanel alternative. Depending upon your needs you can either choose a free or paid version as well.

OpenLiteSpeed vs NGINX

OpenLiteSpeed is getting lots of attention lately. OpenLiteSpeed is an open source version of LiteSpeed Enterprise Web Server that shares the same code base thus you eventually get the same Enterprise Grade performance. Today we will see the performance of openlitespeed vs nginx.  We will look into various scenarios such as

 

  1. Static file performance of openlitespeed vs nginx.
  2. Simple PHP file performance.
  3. WordPress site performance with and without LSCache and FastCGI Cache for NGINX.

 

We will run our tests on DigitalOcean $5 Droplet with following specs:

 

  1. 1GB Ram.
  2. 25GB SSD Disk Space.

 

For OpenLiteSpeed environment, we will install CyberPanel and for NGINX environment we will use clean VestaCP installation. We will be using h2load for benchmarking on a DigitalOcean $10 plan. (All these virtual machines reside in Frankfurt location)


Install h2load (nghttp2)

 

As mentioned above, we are going to use h2load for performing benchmarks. On our Centos 7.6 DigitalOcean server ($10 plan) we ran following commands to install h2load

 

yum install epel-release -y

yum install nghttp2

 

Then make sure it is installed

 

[[email protected] nghttp2]# h2load –version
h2load nghttp2/1.31.1

 

This server is only dedicated to run the benchmarks.


Make sure to Enable HTTP2 on NGINX Server

 

By default on VestaCP, you get HTTP 1.1 with NGINX. You can open the vhost configuration file to turn on HTTP2.

 

nano /home/admin/conf/web/yourdomain.com.nginx.ssl.conf

 

Replace yourdomain.com with the domain you have on VestaCP. Once in the file convert

 

server {
listen 192.168.100.1:443;

 

Into

 

server {
listen 192.168.100.1:443 ssl http2;

 

Save the file and restart nginx using systemctl restart nginx. On CyberPanel you will get HTTP2 by default.


Let’s test a small static file of 725 Bytes

 

In this test, we will be using the following command

 

h2load -t1 -H ‘Accept-Encoding: gzip’ -c1000 -n100000

 

 

OpenLiteSpeed completed the requests in almost half the time.

 

Result for OpenLiteSpeed

 

[[email protected] nghttp2]# h2load -t1 -H ‘Accept-Encoding: gzip’ -c1000 -n100000 $domainols
starting benchmark…
spawning thread #0: 1000 total client(s). 100000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES128-GCM-SHA256
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 7.77s, 12864.34 req/s, 4.71MB/s
requests: 100000 total, 100000 started, 100000 done, 100000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 100000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 36.64MB (38416114) total, 1.21MB (1267114) headers (space savings 94.34%), 32.81MB (34400000) data
min max mean sd +/- sd
time for request: 4.47ms 468.95ms 66.97ms 16.56ms 94.64%
time for connect: 186.83ms 1.97s 864.64ms 371.78ms 88.00%
time to 1st byte: 615.39ms 2.03s 970.81ms 343.46ms 90.80%
req/s : 12.90 13.47 13.23 0.14 70.60%

 

 

Result for NGINX

 

[[email protected] nghttp2]# h2load -t1 -H ‘Accept-Encoding: gzip’ -c1000 -n100000 $domainnginx
starting benchmark…
spawning thread #0: 1000 total client(s). 100000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 17.68s, 5657.34 req/s, 2.57MB/s
requests: 100000 total, 100000 started, 100000 done, 100000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 100000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 45.35MB (47549000) total, 10.78MB (11300000) headers (space savings 35.80%), 32.81MB (34400000) data
min max mean sd +/- sd
time for request: 69.67ms 1.46s 104.37ms 74.98ms 96.91%
time for connect: 6.19s 7.76s 7.13s 521.05ms 61.80%
time to 1st byte: 7.66s 7.95s 7.75s 71.72ms 62.60%
req/s : 5.66 5.71 5.69 0.01 66.90%

 

Make sure that when you run the test against NGINX application protocol is h2.


Static file of size 2MB

 

In this test, we will be using the following command

 

h2load -t1 -H ‘Accept-Encoding: gzip’ -c100 -n1000

 

 

OpenLiteSpeed completed the requests in 8.4 seconds, while for the same number of requests NGINX took 74.81 seconds.

 

Result for OpenLiteSpeed

 

[[email protected] nghttp2]# h2load -t1 -H ‘Accept-Encoding: gzip’ -c100 -n1000 $domainols
starting benchmark…
spawning thread #0: 100 total client(s). 1000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES128-GCM-SHA256
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 8.40s, 119.05 req/s, 231.84MB/s
requests: 1000 total, 1000 started, 1000 done, 1000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 1000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 1.90GB (2041926867) total, 37.08KB (37967) headers (space savings 83.56%), 1.90GB (2036628000) data
min max mean sd +/- sd
time for request: 7.53ms 1.94s 791.62ms 185.17ms 75.20%
time for connect: 101.46ms 112.75ms 107.14ms 2.21ms 71.00%
time to 1st byte: 115.26ms 136.43ms 125.44ms 5.40ms 61.00%
req/s : 1.19 1.40 1.25 0.04 68.00%

 

 

Result for NGINX

 

[[email protected] nghttp2]# h2load -t1 -H ‘Accept-Encoding: gzip’ -c100 -n1000 $domainnginx
starting benchmark…
spawning thread #0: 100 total client(s). 1000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 74.81s, 13.37 req/s, 25.99MB/s
requests: 1000 total, 1000 started, 1000 done, 1000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 1000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 1.90GB (2039006900) total, 112.30KB (115000) headers (space savings 35.75%), 1.90GB (2036628000) data
min max mean sd +/- sd
time for request: 66.81ms 44.02s 7.04s 1.82s 92.30%
time for connect: 545.07ms 920.01ms 646.84ms 92.66ms 86.00%
time to 1st byte: 635.69ms 8.21s 4.34s 2.17s 59.00%
req/s : 0.13 0.15 0.14 0.00 61.00%

 

In both large and small files OpenLiteSpeed clearly stands a winner.


Testing a simple PHP Hello World Application

 

We will now create a simple php file with the following content:

 

<?php

echo “hello world”

?>

 

Additional Configuration for OpenLiteSpeed

 

PHP_LSAPI_CHILDREN=10

LSAPI_AVOID_FORK=1

 

Additional Configuration for NGINX

 

pm.start_servers = 10

 

Command Used

 

h2load -t1 -H ‘Accept-Encoding: gzip’ -c1000 -n100000

 

 

OpenLiteSpeed completed the requests in 23.76 seconds, while for the same number of requests NGINX took 115.02 seconds. OpenLiteSpeed is a winner with PHP application due to its own implementation of PHP processes called LSPHP (PHP + LSAPI) it performs much better then PHP-FPM which is being used with NGINX.


LiteSpeed Cache vs FastCGI Caching with NGINX

 

We will now discuss caching in OpenLiteSpeed and NGINX.

 

 

With OpenLiteSpeed web server you get a built-in cache module and with NGINX you get a FastCGI Caching Module.

 

Why OpenLiteSpeed Cache Module is better?

 

  1. Tag-based caching, pages can be cached for an unlimited amount of time until the cache copy gets invalid.
  2. Built right into the Web server.
  3. Multiple Cache modules available for popular CMS.
  4. Use disk to save cache copies.

 

What is wrong with NGINX Based FastCGI Caching

 

  1. Not tag based caching, or you can say time-based caching.
  2. This type of caching is not intelligent and does not know when to invalidate the cache copy.
  3. You can use as MicroCaching but it is explained here as to why MicroCaching is not recommended.

Benchmarking LiteSpeed vs NGINX for WordPress

 

We will now benchmark litespeed vs nginx for wordpress by installing WordPress on both.

 

  1. OpenLiteSpeed will use LiteSpeed Official WordPress Caching Plugin.
  2. On NGINX setup we will use Cache Enabler Caching plugin.

 

Command used

 

h2load -t1 -H ‘Accept-Encoding: gzip’ -c100 -n1000

 

 

The first question after seeing the graph above will be why OpenLiteSpeed took only 1.4 seconds and NGINX (even using the cache plugin) took 91.6 seconds to complete the same number of requests. Let’s recall the image we shared above.

 

 

Here you can see that in case of OpenLiteSpeed when there is a cache hit, request does not go to PHP Engine which is a very costly operation that causes all the bottleneck. Because OpenLiteSpeed cache module sits inside the web server and all logic is handled there, which means no need to invoke PHP Engine.

 

However in case of NGINX, it is not true, Cache Enabler plugin resides on the PHP side. So even if there is a cache hit, PHP needs to be forked and used which causes all the bottleneck.  Let see the detailed results now

 

OpenLiteSpeed

 

[[email protected] nghttp2]# h2load -t1 -H ‘Accept-Encoding: gzip’ -c100 -n10000 $domainols
starting benchmark…
spawning thread #0: 100 total client(s). 10000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES128-GCM-SHA256
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 1.44s, 6925.11 req/s, 25.10MB/s
requests: 10000 total, 10000 started, 10000 done, 10000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 10000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 36.25MB (38006300) total, 118.55KB (121400) headers (space savings 95.55%), 35.87MB (37610000) data
min max mean sd +/- sd
time for request: 9.31ms 20.81ms 13.39ms 1.13ms 89.23%
time for connect: 89.91ms 100.89ms 95.89ms 2.78ms 64.00%
time to 1st byte: 101.79ms 113.77ms 107.89ms 3.45ms 61.00%
req/s : 69.35 70.00 69.66 0.19 62.00%

 

NGINX

 

[[email protected] nghttp2]# h2load -t1 -H ‘Accept-Encoding: gzip’ -c100 -n10000 $domainnginx
starting benchmark…
spawning thread #0: 100 total client(s). 10000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 91.69s, 109.06 req/s, 417.50KB/s
requests: 10000 total, 10000 started, 10000 done, 10000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 10000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 37.38MB (39198270) total, 1.44MB (1513370) headers (space savings 27.93%), 35.76MB (37500000) data
min max mean sd +/- sd
time for request: 355.76ms 1.23s 907.05ms 78.63ms 76.91%
time for connect: 357.00ms 678.18ms 506.17ms 153.42ms 54.00%
time to 1st byte: 712.81ms 1.60s 1.15s 264.29ms 57.00%
req/s : 1.09 1.10 1.10 0.00 57.00%


OpenLiteSpeed and .htaccess

 

OpenLiteSpeed also have a support for .htaccess file (very popular feature provided by Apache Web Server). But some people confuse with with slow performance, yes incase of Apache your performance will get affected if you have enabled the use of .htaccess file. However in case of OpenLiteSpeed it will only look for .htaccess file in the directory for the first time, which means you get benefit of .htaccess file along with high performance.


Conclusion

 

We ran multiple type of tests

 

  1. Small static file.
  2. Large static file.
  3. Simple Hello World php application.
  4. WordPress Site

 

In all the cases OpenLiteSpeed was clear winner against NGINX. So what are you waiting for, you can start right now with our managed vps service and let us handle the speed for you. You get 3 days free trial (no credit card required) with free migration.

InnoDB: Cannot allocate memory for the buffer pool [Solved]

Recently we received a ticket where the client pointed out that his MySQL server was not starting. Upon investigation, we found out that the client used our MySQL Optimization tool to optimize and enhance MySQL performance. Our MySQL optimization tool set value of innodb-buffer-pool-size size depending upon the available ram on the server. The current formula set its value to 35% of the server ram. Which is fine for most cases, but in this case it was not good, because there were some other processes in the client server taking more ram, so there was not enough ram available to allocate for innodb-buffer-pool-size thus MySQL reports  InnoDB: Cannot allocate memory for the buffer pool as error in MySQL log file.

 

Depending upon the MySQL version you might also receive innodb fatal error cannot allocate memory for the buffer pool as an error, which is the same error with a different description.

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with MySQL optimizations.


What is InnoDB Buffer Pool (innodb_buffer_pool_size) and why it is important?

 

InnoDB Buffer is the space in memory used by MySQL to hold many of its InnoDB data structures. Such as caches, buffers, indexes, and even row data. And then innodb_buffer_pool_size is the MySQL directive that controls its value. This is one of the most significant directive in MySQL perspective and should be set with care if you want to improve your MySQL performance.

 

In this tutorial we will see how we can calculate and set optimal value for innodb_buffer_pool_size depending on the available memory on your system and then we will discuss on how to solve InnoDB: Cannot allocate memory for the buffer pool error in case you run into it at a later point in time.


70% – 80% of the Available Ram

 

Normally if your server is only dedicated for MySQL it is recommended to set innodb_buffer_pool_size value to 70-80% of the available ram. So for example, if your server has 8GB of ram, you can calculate the value of innodb_buffer_pool_size using this formula

 

8 * 0.80 = 6.4GB

 

But in case if your server has a very large amount of ram such as 256GB, then you can further enhance it to 90% as well. Because if your server is only being used for MySQL, the rest of the ram will go in waste, so you can increase or decrease this value depending upon the available ram or your needs.

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with MySQL optimizations.


Optimal value with CyberPanel

 

When you are using CyberPanel then 70-80% ram cannot be allocated for innodb_buffer_pool_size size, because there are many other things running and there must be some room for them to breath. Otherwise, if you set a large value for innodb_buffer_pool_size you will start receiving InnoDB: Cannot allocate memory for the buffer pool or innodb fatal error cannot allocate memory for the buffer pool as an error. Which means there is not enough ram available and MySQL cannot start now. Which is why our optimization tool set it to 35% of the available ram.

 

But sometimes 35% is not good as well. For example, you have lots of websites and they are continuously forking PHP processes and you are also using FTP and DNS server. Then you either need to further go down with the value of innodb_buffer_pool_size.


Fixing the InnoDB: Cannot allocate memory for the buffer pool error

 

Now let see how we can fix this error, let say you have used or MySQL Optimization tool, and now MySQL is not starting. First, make sure that this is the reason your MySQL is not starting. You can open the MySQL log file located at /var/lib/mysql/mysqld.log. This location is set by our optimization tool, if you are not using our tool, you can find MySQL log file depending upon your configuration, and you must see the following lines somewhere in the log file

 

2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: The InnoDB memory heap is disabled
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Compressed tables use zlib 1.2.7
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Using Linux native AIO
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Using SSE crc32 instructions
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Initializing buffer pool, size = 358.0M
InnoDB: mmap(393183232 bytes) failed; errno 12
2019-06-11 10:52:09 140525444196608 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-06-11 10:52:09 140525444196608 [ERROR] Plugin ‘InnoDB’ init function returned error.
2019-06-11 10:52:09 140525444196608 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.

 

Pay close attention to the bold lines, we are now sure that MySQL failed at InnoDB: Initializing buffer pool. Now open /etc/my.cnf and find innodb-buffer-pool-size = xxxM. Now set the value of this directive to something lower such as 50MB just for test and restart MySQL using systemctl restart mysql. However, you can play with various values and make sure you get the optimal value for your configuration.

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with MySQL optimizations.

 

2 – Apply Limits to Websites

Before reading this document you must read:

 

  1. Introduction to Containerization (Website Limits)

 

To apply limits navigate to Containerization https://cloud.cyberhosting.org/servers/manage/ "Order ID" /Containerization . Once there click launch, so that you can manage limits for the site. Click Edit to set the limits. You will see default limits but they are not currently applied.


Limits Explained

 

You can apply 4 type of limits, and they are explained below.

 

CPU Percentage

 

Amount of CPU a certain website/user can use. On a Multi-core system user will get assigned share on each CPU Core. But CPU usage calculation will be divided by total cores on system. For example if website is assigned 10% CPU on a 4 core system, they will get 10% share of each CPU core.

 

If website start using 10% CPU on all 4 cores the average usage will then be 10% (40 / 4 = 10%)

 

Memory

 

Memory usage specifies the amount of RAM the website can use. User processes may be killed by kernel if they try to allocate more ram.

 

I/O

 

Disk I/O speed allowed for the website such as 10MB/s. This limit is not the same as IOPS  described below.

 

IOPS

 

IOPS is different compared to IO, this specifies number of IO operations that a website user can do per second.

 

Network Speed

 

This specifies upload/download speed of the website user.

1 – Introduction to Containerization (Website Limits)

Containerization feature via our Cloud Platform (CyberPanel v1.8.4 and above required, currently only CentOS is supported) offers to limit website resources. With containerization you can limit various system resources for a website, cgroups are used on the back end to enforce these limits. You can limit:

 

  1. CPU Usage.
  2. Memory Usage.
  3. Network Usage.
  4. Disk Usage (IO and IOPS)

 

These limits are applied to all processes forked under a website user (Such as lsphp processes). You can use ls -la /home command to find out user of each website. LiteSpeed Webserver forks php processes for sites using these Linux user accounts. If there are no limits applied a single tenant can use all available resources on your system.

 

Next: Apply Limits to Websites

550-5.7.1 rate of unsolicited mail originating from your IP address

Recently we ran into a problem with one of our client, who is having 550-5.7.1 rate of unsolicited mail originating from your IP address as an error message when sending emails. We recently discussed How To Fix ‘550 Permanent Failure For One Or More Recipients’ and How To: Email Blacklist Removal. But today we will discuss about 550-5.7.1 rate of unsolicited mail originating from your IP address, this error was originating when our client was sending email to Gmail addresses. Let see how we can debug and fix this error.

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with email problems.


IP Listed on Spam Monitor

 

Gmail use services of various spam monitors to check if IP is involved in any bad practices. And it turns out that our client IP was listed in SPAMHAUS monitor. Thus Google was simply denying our mails. You can follow our Email Blacklist removal article to fix this issue.

 

Once your IP is removed from spam monitors list, you will be good to send email again.

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with email problems.


inet_protocols = all

 

We managed to get our client IP removed from the spam monitor, but emails were still not going through. Once we dug deeper it turns out IPv6 of the server was also on the spam monitor blacklist and postfix was using IPv6 to send emails, thus ending up being rejected. In this case, you can follow a similar procedure and get your IPv6 removed from spam monitor.

 

Or you can configure postfix to only use ipv4 protocol. Open /etc/postfix/main.cf in any editor and change inet_protocols = all to inet_protocols = ipv4. Now postfix will send emails through your IPv4 address only, which you have already cleaned in the last step. Finally restart postfix:

 

systemctl restart postfix


smtp_bind_address

 

Incase you are listed on various spam monitors (as some old tenant of the IP did some serious spam), you can assign or request a new IP address from your hosting provider and configure the IP on your server. Then you can use smtp_bind_address = 192.168.100.1 to make sure postfix is using your new IP address to send emails. Also, make sure that your new IP was also clean.

Finally restart postfix:

 

systemctl restart postfix

Note: Replace 192.168.100.1 in the above example with your new assigned IP address from your provider

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with email problems.

How to: Email Blacklist Removal

If you regularly send transactional/marketing emails you may have ran into a problem of emails not getting being delivered, out of many reasons one reason is that your IP might have been blacklisted on a spam monitor. These companies maintain a list of IPs who send out email spam, and email servers use services of these spam monitors to check if the sender IP address is listed on the spam monitor.

 

If it is listed on one of the many spam monitors (such as BARRACUDA) it is highly likely that most popular email companies will not accept your email as they consider you a spammer sending spam emails.  Today this tutorial is about Email Blacklist Removal, which is a process of getting your IP removed from those spam monitors.

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with email problems.


Check if IP Is Backlisted

First thing you need to check is that are you even listed on a blacklist or not because if your emails are not getting delivered there can be many other reasons. So make sure that you are listed on a black list, otherwise, you need to follow a different path to fix email deliverability.

 

Go to https://mxtoolbox.com/blacklists.aspx

 

 

  1. Enter the IP address that you want to check against blacklist monitors and click Blacklist Check.
  2. You can see that the searched IP is listed on BARRACUDA spam monitor, and probably mail from this IP won’t be reaching to the inbox of most popular email service providers (Google, Outlook, etc) or maybe they completely reject your email.

 

At this point, you are sure that you are listed on a blacklist and you need to do something about it. We will start discussing how to get delisted from few spam monitors.


Resolve the problem first

 

Before applying to get removed from any spam monitor, make sure that your server is not doing something fishy, so that you won’t get banned or even your removal appeal being completely rejected. You can check various server logs and try to identify what is happening on your server. Some useful commands are:

cat /var/log/maillog

journalctl -f | grep postfix

 

Try to inspect the log files and fix the issue before applying for removal. However if you just got a new server, and you found out that your IP is blacklisted, it is highly likely that old tenant of this IP did some email spamming, in this case ,you can just go ahead and submit removal request, you can explain in the removal request that you just got the fresh virtual machine/ dedicated server and someone previously did something due to which your IP is black listed.

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with email problems.

 


Get your IP removed from Barracuda Spam Monitor

To get your IP removed from Barracude visit the removal request page.

 

 

  1. Enter server IP Address you want to get removed from the spam monitor.
  2. Email address where you will be contacted.
  3. Your modile phone number.
  4. Provide the reason, I just entered an example reason. Make sure you provide a valid reason for removal.
  5. And finally, submit your request.

 

It usually takes then 12 hours to process your request, if you provided a valid reason then just sit back and relax.


Get your IP removed from Spamhaus Spam Monitor

 

To get your IP removed from Barracude visit the removal request page.

 

 

Enter your server IP Address in the box, it will first do a lookup and then give you options to remove if it is listed in the monitor. If your IP is on the list you will see something like:

 

 

In this case, IP was not directly listed on SPAMHAUS it was on ABUSEAT CBL blocklist, Click on CBL Lookup to get further details of this issue.

 

 

Here you can do the lookup again, come at the bottom of this page and click Remove to perform self-removal. Please note that even after removal, you might still not be able to send emails as your earlier abuse status might be cached on email servers, it will auto-heal in ca ouple of hours.

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with email problems.


Get your IP removed from SORBS Spam Monitor

 

Updated on: June 27th, 2019

 

Recently we got a client whose IP was listed on SORBS monitor. It was very tricky to do an IP lookup on their site (we mentioned link for removal from their site below). So to lookup and get your IP delisted on SORBS, you need to be registered on their site. You can go here -> http://www.sorbs.net/cgi-bin/support

 

First register and do and IP lookup after you login, they will provide you an option to do lookup. It will then present you with information weather you are listed on the monitor or not. Now if you are owner of the IP space you can click Get Delisted. If you are not the owner of IP, you can’t get delisted automatically.

 

Just email [email protected], with reason explaining why you want this IP to be removed from their monitor. They are pretty fast in replying and if you have provided a valid reason your IP will be removed within few minutes.

 


Links to other Spam Monitor Removal Lists

 

We discussed the process of removal for two Spam monitors, process for other Spam Monitors are pretty much the same. I’ve listed the links to the removal page of other Spam Monitors below:

 

LashBack UBLhttp://blacklist.lashback.com/
Backscatter Blacklisthttp://www.backscatterer.org/?target=test
Barracuda Blacklisthttp://www.barracudacentral.org/rbl/removal-request
Invaluement Blacklisthttp://dnsbl.invaluement.com/lookup/
APNewshttp://www.apews.org/?page=index
SpamCop Blacklistwww.spamcop.net/bl.shtml
UCE Protect Blacklisthttp://www.uceprotect.net/en/index.php?m=7&s=6
Sorbs Blacklisthttp://www.sorbs.net/cgi-bin/support
Truncate BlacklistAutomatic Only

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with email problems.

.htaccess 301 redirect

What is .htaccess?

 

.htaccess is a configuration file used by Apache Web Server Software. Through .htaccess file, you can change the configuration of Apache Web Server to enable or disable rewrite rules and some functionality the Apache Web Server has to offer. Note .htaccess files must be uploaded in ASCII mode (binary mode is not supported). Some basic functionality that can be controlled via Apache .htaccess is:

 

  1. Setting 404 file not found file when this error occurs.
  2. Password protection
  3. Image hotlink prevention.
  4. Most import is url rewriting (which is the main discussions of todays article)

 

Todays tutorial is mainly about .htaccess 301 redirect, which is just another example of using rewriting capabilities of Apache Web Server through .htaccess file. Also note that with our managed vps service, you can use super fast OpenLiteSpeed Server along with Apache on back end, thus you will get speed of OpenLiteSpeed and all the goodies of Apache Web Server such as .htaccess compabitibility. This set up also works with LSCache WordPress plugin which means you can also get full benefits of OpenLiteSpeed full page caching.


.htaccess redirect 301

 

The .htaccess file allows the user to move from one document on the website to another through rewrite directives. 301 redirect allows webmasters to permanently move users to new URL while replacing the old URL and tell the Search Engines that the page has moved to another new URL so the new page is properly indexed in google.

 

If you have root access to your VPS you can also set rewrite rules in your main apache configuration file, which will increase your website speed (make sure to set  AllowOverride None, which tells apache not to look for .htaccess files in every directory it servers content from, thus improving overall speed). However if you don’t have root access (in case of shared hosting) you will have to use a rewrite file (.htaccess) at directory level.

 

Common uses of a 301 redirect:

 

  1. After moving your site to a new domain, you can use 301 redirect on the old domain to send visitors to the new site.
  2. After moving old site pages to a new site structure, use 301 redirects to send users to the new pages.
  3. After combining two sites, use 301 redirects to ensure visitors go to the new pages or the right pages.

 

Single URL redirect:

Allow the user to redirect permanently from old_page.html to new_page.html. For the redirection, you have to add the following code in your .htaccess file:

Redirect 301 /old_page.html http://www.yourdomain.com/new_page.html

 

Entire domain redirect:

.htaccess 301 redirect also allows the user to permanent redirect from all domain pages to your new domain. For the redirection, you have to add the following code in your .htaccess file:

Redirect 301 / http://www.newdomain.com/

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now.

 

HTTP to HTTPS redirect:

Redirect 301 allows the user to redirect the website from HTTP to HTTPS secure mode. For the redirection, you have to add the following code in your .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

HTTP TO HTTPS redirect in CyberPanel

CyberPanel gives you one-click solution for HTTP -> HTTPS redirection.

 

Wesbites -> List Wesbites -> Manage

 

 

 

  1. Once on the Manage page of the website click Rewrite Rules.
  2. From drop down select Forcee HTTP -> HTTPS (Rewrite rules will be populated automatically).
  3. Click Save Rewrite Rules.

 

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now.


How to 301 Redirect WordPress Content Using .htaccess in CyberPanel

 

A 301 redirect is a permanent redirect and it tells search engines, including Google to remove the original URL from their index and replace it with the one you’re redirecting to. So let’s put that code from above into your .htaccess file and redirect some pages.

 

First log into CyberPanel dashboard. Navigate to Websites -> List Websites then try to find Manage button or just click on the link /home/example.cyberhosting.org/public_html this will file manager and navigate you to the document root of the website.

 

You can also log into your website root using FTP account if you are more comfortable with that.

 

 

In the Document Root of WordPress, find the .htaccess file and edit it. Copy Paste the redirect 301 code in a .htaccess file and click on save changes.

Code:

Redirect 301 /old_page/ http://domain.com/new_page/

 

 

You can test the website URL redirection immediately after saving the changes in the .htaccess file. If you are not redirected then something went wrong. That is how you redirect a page or redirect URL using .htaccess.


What is Error Document in .htaccess

 

Apart from using .htaccess file for rewriting you can also set up custom error pages in case of 404 or other errors. Making Custom error page in your website is very helpful, it allows a user to see the custom user-friendly error message in case your application ran into some problem or user tried to access the page which does not exists (404 error). Let’s suppose you create the custom error page for your website and now you want to activate in the .htaccess file. Move to your root directly of your web site and find the .htaccess file. If you find the file you need to edit it, if there is no such file you can create your own .htaccess file.

Add the following lines in your .htaccess file:

ErrorDocument 404 /error404.html

After ErrorDocument specifies the error code, followed by a space, and then the path and filename of the .html customized error file you would like to be displayed when the specified error is generated.

If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now.


CyberPanel and .htaccess

 

Since we provide our managed services on CyberPanel, you need to be extra careful if you are only using CyberPanel with OpenLiteSpeed, because OpenLiteSpeed does not support all the directives of Apache Web Server, unless you are using our managed vps service where you can use Apache behind OpenLiteSpeed which means you get all the features of Apache Web Server and speed of OpenLiteSpeed.