Nginx is a lightweight web server and a reverse proxy server that is famous for low system resources usage, fast delivery of static content and dynamic content if using FastCGI, CSGI and other handlers. Nginx has proved itself as a reliable software load balancer and as a caching server.

Table of Contents

Introduction

Manual Nginx installation

Automatic Nginx installation

Summary

External links

Introduction

You always get what you want… Before I tried to install Nginx on cPanel based server I practised with it a lot. I already installed it on several servers running Apache. It was running there as a reverse proxy and somewhere as a caching server. So when I got a task to install Nginx on cPanel I searched Google for something like “apache nginx cpanel install” and I found an article nginx + apache = happy & fast cPanel server that guided me through manual installation process…

But manual installation has some issues and I am going to describe them in the next section.

 

Manual Nginx installation

Manual Nginx installationIf you are reading this section I assume that you are already familiar with Nginx, Apache and cPanel, you know what mod_rpaf is and how to install software from source. At least you should have good copy/paste skills and you should not afraid of black console screen. :)

Though I used nginx + apache = happy & fast cPanel server guide as a starting point I made some changes to this guide:

 

  1. Since I installed Nginx using “yum” package installer and not from source I had to change all configuration paths from “/usr/local/nginx/conf/vhost.conf” to “/etc/nginx/conf/vhost.conf”.
  2. I uncommented the “location” section since I wanted to serve static files by Nginx.
  3. I removed “htm|html” from the extension list since some WordPress sites on that server had permalinks ended in “.html” or “.htm”.

Nginx worked like a charm. The main issue I faced later when I had to re-run the configuration script each time I added new domain or a sub-domain to my account. Author of “nginx + apache” article said that it is possible to setup a hook for cPanel scripts, that will reconfigure Nginx automatically, but I did not find this “hook” and the lack of Perl knowledge did not allow to do it myself.

Only a month or two later I found that the plugins that allowed you to install Nginx on the cPanel server automatically and “out of the box” already existed.

 

Automatic Nginx installation

automatic nginx installationThere are several cPanel plugins available that allow you to install Nginx on the cPanel server automatically with a minimum technical skills required.

Nginx Admin by http://nginxcp.com/ – free Nginx plugin for cPanel. As I can see from their blog, project is active and updated monthly. You can get a free installation if you donate any amount more than $10.

cPaneL Nginx by http://syslint.com – product homepage - http://cpnginx.com/. Plugin available at 5$/Month for Individual licence and at 3$/Month for Datacenter license. Has 15 days trial period.

NGINX Integration by http://www.remsys.com/ – product homepage – http://www.setupnginx.com/. Plugin available at $20 one time licence and at $10 if you use coupon code “NGINX”. :)

Please let me know if I missed something and I will be happy to add it to my list.

 

Summary

Well, I hope this post will help you to choose the best way of integrating Nginx and cPanel server. If you already used one of the methods above – please, leave a comment! Share your experience!

 

External links

  1. http://en.wikipedia.org/wiki/Nginx
  2. http://wiki.nginx.org/Main
  3. http://www.hostmedic.com/admin/network_administration/nginx-apache-happy-fast-cpanel-server/
  4. http://cpnginx.com/
  5. http://syslint.com/cPnginx
  6. http://www.setupnginx.com/
  7. http://www.remsys.com/products
  8. http://nginxcp.com/

Tags: , , , , , , , , ,

EugeneWHZ on January 2nd, 2012

Due to the popularity of my previous post that guides how to increase upload_max_filesize on cPanel server I decided to create a more general article, that covers changing of other PHP settings using php.ini and .htaccess files.

In this article we will change the following php settings:

  • memory_limit – maximum amount of physical memory that can be allocated to PHP script
  • max_post_size – maximum size of data that can be transferred via POST method
  • register_globals – this variable allows to enable or disable register_globals
  • file_uploads – enables or disables file_uploads

First we will create our custom php.ini file:

  1. Login to your cPanel account, open public_html directory and create blank php.ini file
  2. Put php settings that you would like to change into the file. I will put all php variables, but if you would like to leave default values for some of them you can exclude them from the list

[PHP]
; increase php memory_limit to 128M
memory_limit = 128M
; increase php max_post_size to 20M
max_post_size = 20M
; enable file uploads
file_uploads = On
;disable register_globals
register_globals = Off

  1. Save php.ini file

Next we will create a custom .htaccess file. This is the most important step!

  1.  Edit .htaccess file and put there the path to your php.ini file. Replace “/home/whz/public_html” with path to your php.ini file. If your php.ini file is located in public_html directory, you only need to replace “whz” with your cPanel username

suPHP_ConfigPath /home/whz/public_html

  1. Save .htaccess file

Did this article help you? Leave your comment!

Tags: , , , , , ,

EugeneWHZ on December 16th, 2011

More general article is available here. It guides how to change php settings on cPanel server using php.ini and .htaccess files.

Recently I had to increase the upload_max_filesize value for Joomla website. It was running on the cPanel based server. You would say – “It‘s an easy task!”. Right, the upload_max_filesize can be easily changed via php.ini file.

I was going to increase my upload limits to 50MB, so I added upload_max_filesize = 50M to my php.ini file and uploaded it into public_html directory. When I tried to upload 10MB file via Joomla backend, I got the error… upload_max_filesize was still set to 2M…

While phpinfo was showing, that upload_max_filesize is set to 50M, this value was set to 2M in Joomla. To check your PHP settings in Joomla, just login to admin panel, go to General >> System information >> PHP settings.

Finally the solution was found on www.lunarforums.com. In two words, you just need to specify the correct path to your php.ini file. Open your .htaccess file and put there the following line:

suPHP_ConfigPath /path/to/your/public_html

Replace “/path/to/your/public_html” with path to the directory that contains your php.ini file. In my case settings was the following:

.htacess file:

suPHP_ConfigPath /home/webhostingzone/public_html

php.ini file:

[PHP]
file_uploads = On
upload_max_filesize = 50M
post_max_size = 50M

Was this article helpful? Please leave a comment!

Tags: , , , , ,

EugeneWHZ on December 13th, 2011

When choosing from various SEO methods you should always balance between efficiency, price and associated risks. You do not want to be penalized, removed from index or have your AdSense account banned, right? Based on the risks associated with running your marketing campaign, all SEO methods are divided into White-Hat SEO, Grey-Hat SEO and Black-Hat SEO.

Content Creation – one of the most White-Hat SEO methods. Both you and your visitors benefit from high-quality, interesting and unique content. Though, the content creation is one of the time consuming SEO methods, it will bring you long term benefits such as search engine traffic and unique visitors. It does not matter, whether you write content by yourself or you hire professional content writers, the main rules are the same – your content should be unique and interesting.

Tags: , ,

EugeneWHZ on November 8th, 2011

This article applies to CentOS 5.x systems and was tested on CentOS 5.7 and on Amazon AWS linux.

 HowTo install ImageMagick from YUM repository

The easiest way to install ImageMagick extension is to install it from yum repository:

1) Run “yum search imagick” command to check if ImageMagick extension is available in your repositories.

If you get the line below – ImageMagick extension is available in your repository and you can install it using “yum install” command

================ N/S Matched: imagick  ================

php-pecl-imagick.i686 : Provides a wrapper to the ImageMagick library

2) Run “yum install php-pecl-imagick” to install ImageMagick extension.

3) Restart Apache webserver.

HowTo install ImageMagick using PECL extension installer

If you need to install ImageMagick extension for PHP and you can not find it in your Linux distribution repository you can follow steps below to install it using PECL:

1) Install PECL if it is not installed. As root run the following command:

# yum install php-pear

2) Install compilers if they are not installed

# yum install gcc make

3) Install ImageMagick extension

# pecl install imagick

4) Enable ImageMagick extension in your PHP configuration

# echo “extension=imagick.so” > /etc/php.d/imagick.ini

5) Verify that ImageMagick extension is enabled

# php -m

If you see “imagick” in the output of the command above – it means that InageMagick extension has been successfully installed.

6) Restart Apache web server to start using ImageMagick in your application./strong

Tags: , , , , ,

If you find the following error in your EXIM logs, it means that your EXIM databases could be corrupted.

defer (-53): retry time not reached for any host

Solution was found at forums.cpanel.net. To rebuild exim databases you can run the following commands as root:

/usr/sbin/exim_tidydb -t 1d /var/spool/exim retry > /dev/null
/usr/sbin/exim_tidydb -t 1d /var/spool/exim reject > /dev/null
/usr/sbin/exim_tidydb -t 1d /var/spool/exim wait-remote_smtp > /dev/null
/scripts/eximup –force

This solutions worked for me. I hope it will help you as well.

Tags: , , , , , , ,