Most of the time, there is no need to compile Nginx manually as Debian and Ubuntu provide several packages being compiled with a different set of modules (for details, see: Nginx packages in Debian stable). However, when performing more specific testing tasks, I sometimes need an exact particular version and have to compile it manually.
So here are the required steps to build Nginx with SSL and SPDY modules enabled.
Installing development packages:
apt-get install build-essential libpcre3-dev libssl-dev zlib1g-dev
wget http://nginx.org/download/nginx-1.6.1.tar.gz tar xvfz nginx-1.6.1.tar.gz cd nginx-1.6.1 ./configure --with-http_ssl_module --with-http_spdy_module make && make install
Checking compile time options:
nginx -V nginx version: nginx/1.6.1 built by gcc 4.7.2 (Debian 4.7.2-5) TLS SNI support enabled configure arguments: --with-http_ssl_module --with-http_spdy_module
Lastly, here is a guide on how to compile Nginx on FreeBSD.