Install Nginx On CentOS 5.5 With SSL, PCRE, GeoIP, Zlib, Gzip And DAV Support

Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption. This tutorial shows how you can compile and install Nginx on CentOS 5.5 server with SSL, PCRE, GeoIP, Zlib, Gzip and DAV support.

I do not issue any guarantee that this will work for you!



First we install httpd-devel, pcre, pcre-devel, zlib, zlib-devel, perl, geoip and geoip-devel packages like this:

yum install -y httpd-devel pcre perl pcre-devel zlib zlib-devel GeoIP GeoIP-devel


Download required packages


Now you have to untar these files.

tar -xvf zlib-1.2.5.tar.gz
tar -xvf pcre-8.10.tar.gz
tar -xvf openssl-0.9.8o.tar.gz


Download Nginx source package

You need to download Nginx source package from

tar -xvf nginx-0.7.67.tar.gz
cd nginx-0.7.67


Compile and Install Nginx

Now you can compile and install Nginx with the following commands:

./configure --user=nginx --group=nginx --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --pid-path=/var/run/ --lock-path=/var/lock/subsys/nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-cc-opt='-m32 -march=i386' --with-openssl=/root/openssl-0.9.8o --with-pcre --with-pcre=/root/pcre-8.10 --with-zlib=/root/zlib-1.2.5 --with-http_geoip_module

You can find out more options by using the following command:

./configure --help

Now run:

make install


Configuration Summary

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"


Start Nginx Server

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf



/usr/local/nginx/sbin/nginx -V

Share this page:

Suggested articles

5 Comment(s)

Add comment


By: sj314

Remove --with-cc-opt='-m32 -march=i386' - 64bit platform

By: Eyal Estrin

Hardening guide for Nginx 0.7.65 on RedHat 5.4 (64bit edition)

How to implement SSL on Nginx 0.7.65



Nice tutorial.

Please can you add the necessary  steps to configure and run virtual hosts and mysql support?




By: johandry

I had an error with nginx/tmp/client_body, do this:

mkdir -p /var/lib/nginx/tmp/client_body
chown -R nginx.nginx /var/lib/nginx/
chmod -R 770 /var/lib/nginx/

By: Install SSL on NGINX

Here's a very in-depth guide about installing a signed certificate (free) from StartSSL on a nginx web server:

Hope this helps.