Sunday, September 25, 2011

How To Set Up SSL Vhosts Under Nginx + SNI Support (Ubuntu 11.04/Debian Squeeze)

Enable the vhost and reload nginx:

cd /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/www.hostmauritius.com.vhost www.hostmauritius.com.vhost
/etc/init.d/nginx reload

 

4 Creating A Self-Signed Certificate

Before we set up our SSL vhost, we need an SSL certificate. I will now show you how to create your own self-signed certificate. With this certificate, you will get browser warnings, but this certificate is required to get a trusted certificate from a trusted CA later on.

Make sure that the package ssl-cert is installed:

apt-get install ssl-cert

You can now create a self-signed certificate for www.hostmauritius.com as follows:

make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/ssl/private/www.hostmauritius.com.crt

You will be asked for the hostname:

Host name: <-- www.hostmauritius.com

This will create the self-signed certificate and the private key in one file, /etc/ssl/private/www.hostmauritius.com.crt:

cat /etc/ssl/private/www.hostmauritius.com.crt

-----BEGIN RSA PRIVATE KEY-----MIIEowIBAAKCAQEAsxOSdUsiEcay6M8EpSu5eeC797v/TpDRGnui4uaYd/YpjrPhPWW01FEIpaCixYb5U2uMuvFOlmZhyfer

View the Original article