Last year I quickly commented how to enable SSL on Apache. Now I’ll do the same for Nginx, which has been my primary HTTP server choice since then, BTW.
First, create the certificates:
sudo openssl genrsa -out localhost.key 1024
sudo openssl req -new -key localhost.key -x509 -out localhost.crt
sudo chmod 600 localhost.*
Then edit /etc/nginx/sites-available/default and put the important parts:
listen 443 ssl default_server;
Finally reload Nginx:
sudo service nginx reload
PS: These tips are for development pruposes. In production you’ll need a chained certificate (aka certificate bundle).