Installing Nginx on CentOS Linux

From ISPWiki

Jump to: navigation, search


Installing Nginx on CentOS Linux

(checked 15.07.2010 on CentOS 5.5 32bit) The following document describes how to install an Nginx web-server under CentOS Linux as front-end to ISPmanager.

Ngnix is not included into the CentOS Linux distribution, so you need to use a third-party repository to install it; in our case use the repository.

You also need to install the mod_rpaf module for Apache to correctly recognize a client's IP-address.

Step-by-step instruction

  • Configure a third-party repository with Nginx and mod_rpaf (you must have root privileges):

For i386 architecture (32-bit operating system)

 rpm -ihv

For x86_64 architecture (64-bit operating system)

rpm -ihv

Update the yum and ISPmanager packet cache:

yum makecache
/usr/local/ispmgr/sbin/pkgctl cache

Once it has been updated, log in to ISPmanager as root -> go to the "Server configuration" section-> the Applications (ISPmanager) module and locate "Nginx is a quick and easy WWW server for cashing".

  • Click the "Install" icon on the toolbar. In the repository choose the version you need (either nginx (0.8) or nginx-stable (0.7)
  • Install the selected Nginx version. The server will be configured automatically: Apache will run on port 8080, and Nginx on port 80.

You have successfully installed Nginx as Front-end.

Configuration tips

The /etc/nginx/nginx.conf configuration file in does not provide enough worker processes (worker_processes 10). Change this parameter so that the number of processes equal the number of processor kernels on your server (for example, there is normally one kernel on a virtual machine, so you need to run only one process).

Restart Nginx:


or go to ISPmanager -> the Services (ISPmanager) module.

Technical notes

With Nginx configured, the file will be created in /etc/yum.repos.d/centalt.repo. Disable enabled=1 by specifying enabled=0 if you don't want newer software versions to be installed. If necessary, you can update Nginx by specifying the repository manually. For example:

yum --enablerepo=CentALT update nginx

Thereby, you won't suffer from unexpected change of the software version.

Was this helpful? Yes | No
Personal tools