1. Copy the obtained PFX certificate to a location in the
server (eg: /home/xyz).
2. Convert the PFX
certificate to PEM
openssl pkcs12
-in
demo.pfx -out demo.pem
Enter
the password. Once it is entered, you will be asked for a new password which is
used
to encrypt the private key.
Once
the above step is completed, a PEM file is obtained.
3. Open the PEM file in a text editor
4. Copy the key part in the PEM file along with the dashed
line part to a separate file (eg demo.key).
5. Now the private key has to be decrypted using the
password used in the PFX file.
openssl
rsa
-in demo.key
-out demo.key
6. Copy the files demo.pem and demo.key to /etc/ssl
7. Edit your Nginx virtual host file.
server
{
listen 443;
ssl on;
ssl_certificate /etc/ssl/demo.pem;
ssl_certificate_key /etc/ssl/demo.key;
server_name example.domain.com;
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location / {
root /home/www/public_html/example.domain.com/public/;
index index.html;
}
}
listen 443;
ssl on;
ssl_certificate /etc/ssl/demo.pem;
ssl_certificate_key /etc/ssl/demo.key;
server_name example.domain.com;
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location / {
root /home/www/public_html/example.domain.com/public/;
index index.html;
}
}
8. Restart Nginx Process
sudo /etc/init.d/nginx restart