Download and unpack the latest source from http://wiki..org/NginxInstall. I selected the development version.

server ~ / $ tar zxvf nginx-0.8.35.tar.gz
server ~ / $ cd nginx-0.8.35
server ~ / $ ./configure  --user=nginx --group=nginx  \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--with-http_dav_module --with-http_realip_module \
--with-http_stub_status_module

You might need to install additional package depending on your distribution. If the configure return no errors it is time to compile with the following commands:

server ~ / $ make
server ~ / $ make install

To not mess up to much I prefer to install in the /usr/local/nginx folder and do symlink where needed.

server ~ / $ useradd nginx
server ~ / $ usermod -a -G nginx nginx
server ~ / $ ln -s /usr/local/nginx/conf /etc/nginx
server ~ / $ mkdir /etc/nginx/conf.d
server ~ / $ mkdir -p /var/tmp/nginx/client
server ~ / $ mkdir -p /var/tmp/nginx/proxy
server ~ / $ mkdir -p /var/tmp/nginx/fcgi
server ~ / $ mkdir /etc/nginx/sites-available
server ~ / $ mkdir /etc/nginx/sites-enabled
server ~ / $ ln -s /usr/local/nginx/logs /var/log/nginx
server ~ / $ ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx

Do some configuration as explained in the post nginx and PHP