Install SSL certificate on Nginx step by step

Although I have installed SSL certificates for several times, every time I google step by step guide. So now I take my own note:

Step 1: Generate key

$ openssl genrsa -des3 -out verisign-mydomain.co.uk.key 1024
Generating RSA private key, 1024 bit long modulus
………………….++++++
…………………++++++
e is 65537 (0x10001)
Enter pass phrase for verisign-mydomain.co.uk.key:
Verifying – Enter pass phrase for verisign-mydomain.co.uk.key:

Step 2:  Remove pass phrase from key (otherwise Nginx asks for pass phrase every time it starts)

$ openssl rsa -in verisign-mydomain.co.uk.key -out verisign-mydomain.co.uk.no-passphrase.key
Enter pass phrase for verisign-mydomain.co.uk.key:
writing RSA key

Step 3: Generate CSR

$ openssl req -new -key verisign-mydomain.co.uk.no-passphrase.key -out verisign-mydomain.co.uk.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [GB]:
State or Province Name (full name) [Berkshire]:E Sussex
Locality Name (eg, city) [Newbury]:Brighton
Organization Name (eg, company) [My Company Ltd]:Euro Ltd
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server’s hostname) []:mydomain.co.uk
Email Address []:

Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Step 4: Send CSR to authority and get CRT

Step 5: Download CA intermediate certificate from authroity

Step 6: Concatenate CA intermediate certificate with CRT (CRT on top)

$ cat ca.crt >> my.crt

Step 7: Make necessary changes to Nginx configuration

Nginx only need two file: my.crt (concatenated) and verisign-mydomain.co.uk.no-passphrase.key

Leave a comment

Your email address will not be published. Required fields are marked *