Skip to content

Instantly share code, notes, and snippets.

@Gami-404
Last active November 8, 2021 23:21
Show Gist options
  • Select an option

  • Save Gami-404/56c73c94bfab88ed75a3f9913ed6908b to your computer and use it in GitHub Desktop.

Select an option

Save Gami-404/56c73c94bfab88ed75a3f9913ed6908b to your computer and use it in GitHub Desktop.
How to install .pfx to Nginx

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

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 /var/www/website/;
		 index index.html;
		}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment