Skip to content

Instantly share code, notes, and snippets.

@djblue
Last active August 29, 2015 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djblue/32af845cc2792644bf54 to your computer and use it in GitHub Desktop.
Save djblue/32af845cc2792644bf54 to your computer and use it in GitHub Desktop.
nginx ssl

self signed ssl certificates

When setting up a development server that will be accessible over the internet, it is a good idea to use ssl.

Below are some snippets for setting up self signed certificates:

sudo openssl req -x509 -nodes -days 365 \
                 -newkey rsa:2048 \
                 -keyout /etc/nginx/ssl/nginx.key \
                 -out /etc/nginx/ssl/nginx.crt

Then to enable the certificate in nginx server, edit /etc/nginx/nginx.conf:

server {
  listen 443 ssl;
  ssl_certificate /etc/nginx/ssl/nginx.crt;
  ssl_certificate_key /etc/nginx/ssl/nginx.key;
}

Since they are self signed, you will get warning in your browser. To avoid that, install your certificate into your browser.

Chrome: settings -> Manage certificates... -> Authorities -> Import : select your certificates.

More info here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment