NGINX – Easiest way to setup SSL using .pfx files


I’ll try to explain the easiest way to use a .pfx file that can be used to install SSL on NGINX.

We’ll start by extracting the CRT file using openssl with the following command

openssl pkcs12 -in ./YOUR-PFX-FILE.pfx -clcerts -nokeys -out domain.crt

Followed by extracting the private key with the following command

openssl pkcs12 -in ./YOUR-PFX-FILE.pfx -nocerts -nodes -out domain.rsa

Other NGINX blogs you might find useful

  1. NGINX – Load Balancing your application made simple
  2. NGINX – Redirecting traffic between www and non-www domain
  3. NGINX – Redirecting HTTP to HTTPS
  4. NGINX – Restrict access to Geographical Locations using GeoIP module
  5. NGINX – Disable direct access (via http and https) to a website using IP address

Now we can proceed by setting up a most simple NGINX server using the following configurations

server {
 listen 443 ssl;
 server_name domain.com domain.com;
 ssl_certificate /path/to/your/CRT_file/domain.crt;
 ssl_certificate_key /path/to/your/RSA_file/domain.rsa;

 root /mnt/coming-soon/bushbeans;
 index index.html;
 include /etc/nginx/mime.types;
}

Voila! All done.

knoldus-advt-sticker

This entry was posted in Devops and tagged , , , . Bookmark the permalink.

5 Responses to NGINX – Easiest way to setup SSL using .pfx files

  1. Pingback: NGINX – Load Balancing your application made simple | Knoldus

  2. Pingback: NGINX – Redirecting traffic between www and non-www domain | Knoldus

  3. Pingback: NGINX – Restrict access to Geographical Locations using GeoIP module | Knoldus

  4. Pingback: NGINX – Disable direct access (via http and https) to a website using IP address | Knoldus

  5. Pingback: NGINX – Redirecting HTTP to HTTPS | Knoldus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s