How to generate an SSL Certificate Signing Request for your Nginx Web Server with OpenSSL and install your SSL Certificate on your Nginx web server.
Actually I was surprised how easy it was to install SSL certificates for Nginx on Ubuntu.
I don’t remember if it was needed or not at this point or just when I was installing self signed SSL certificates for testing but, make sure you have the ssl-cert package installed:
admin@www1:~/sudo aptitude install ssl-cert openssl
Then make the CSR:
admin@www1:~/sudo openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
This will start the process to generate two files: the Private-Key file for the decryption of your SSL Certificate, and a certificate signing request (CSR) file used to when ordering your SSL Certificate.
When you are prompted for the Common Name, which is your domain name, enter the fully qualified domain name for the site you are securing. Either www.afterdarkmike.com or afterdarkmike.com. Remember accessing the opposite of which you select via web browser will generate a miss-match domain security warning, with most browsers stopping you there.
If you are generating a Wildcard SSL Certificate for your Nginx server, make sure your common name starts with an asterisk (e.g. *.afterdarkmike.com).
Open the .csr file with a text editor (nano,vi,etc) and copy and paste it (including the BEGIN and END tags) into your SSL order form. Save the certificate files, you will need them later.
In my case I was purchasing a GeoTrust RapidSSL Certificate for a clients website we host and manage at After Dark Communications.
At the time of posting, your RapidSSL order will be shipped via an email which will include the SSL Certificate as well as the intermediate CA bundle. Copy them both into one file, including the —–BEGIN CERTIFICATE—– and —–END CERTIFICATE—– header/footers and save it as commonname.crt. ex afterdarkmike.com.crt.
So your file will look like:
-----BEGIN CERTIFICATE----- Web Server CERTIFICATE blahblah blah blah blahblah blah ... blahblah blah blah blahblah blah -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- INTERMEDIATE CA CERTIFICATE blahblah blah blah blahblah blah ... blahblah blah blah blahblah blah -----END CERTIFICATE-----
Upload it to the server.
Now to set up Nginx.
Edit the Nginx Virtual Hosts File:
server {
listen 443;
ssl on;
<strong>ssl_certificate /etc/ssl/ssl.crt;</strong>
<strong>ssl_certificate_key /etc/ssl/domain.key;</strong>
server_name your.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/your.domain.com/public/;
index index.html;
}
}
Adjust the file names to match the certificate files and restart Nginx.

October 8th, 2011
AfterDarkMike
Posted in
Tags:
Remarkable things here. I am very glad to see your article. It solved a simple task for me.
Great post. I used to be checking constantly this blog and I am inspired! Extremely helpful info particularly the final phase
I maintain such information much. I was looking for this particular information for a long time. Thank you and good luck.
Awesome issues here. I am very happy to look your article. Thank you a lot and I’m looking ahead to contact you. Will you please drop me a e-mail?
Valuable information. Lucky me I found your website accidentally, and I am stunned why this coincidence did not came about earlier! I bookmarked it.
Pretty nice post. I simply stumbled upon your weblog and wanted to mention that I have really enjoyed surfing around your weblog posts. In any case I’ll be subscribing for your feed and I hope you write once more soon!
[...] a:link {text-decoration: none;}.linkboxdisplay a:hover {text-decoration: underline;}Mike Johnsons Personal Blog – SSL certificate installation on Ubuntu/Nginx10.6.8 Installing SSL Certificates CorrectlyHow to Install a GoDaddy SSL Certificate in WHMHow to [...]
Thanks a bunch for sharing this with all folks you actually understand what you’re talking approximately! Bookmarked. Please also discuss with my web site =). We can have a hyperlink change agreement among us
Posted your post, “SSL certificate installation on Ubuntu/Nginx | Mike Johnson’s Personal Blog” on facebook. Regards, Lucas Brandstrom
excellent layout!
Very great post. I just stumbled upon your weblog and wanted to mention that I have really enjoyed browsing your blog posts. After all I will be subscribing in your rss feed and I am hoping you write again soon!
Hi! This is my first visit to your blog you have done a extraordinary job!
Being a site owner, I thought I would give a quick comment to say I like the style and design and information here.
Hey! I just would like to give a huge thumbs up for the great layout.
Hi there, I found your web site via Google even as looking for a similar subject, your site came up, it looks great. I have added to my bookmarks.
Thank you a bunch for sharing this with all of us you actually realize what you are speaking about! Bookmarked. Kindly additionally consult with my website =). We will have a link trade arrangement between us
Very nice post. I just stumbled upon your blog and wished to mention that I’ve really loved browsing your blog posts. After all I’ll be subscribing in your feed and I hope you write once more very soon!
I’m extremely impressed along with your writing abilities and also with the layout in your blog. Did you pay to have it done or modify it your self? Either way, it looks great!
I like the valuable information you provide to your articles.
Found your website through Google. You know I will be subscribing to your feed.
Thank you a lot for sharing this!
Exceptional post however , I was wanting to know if you could write a litte more on this subject? I’d be very grateful if you could elaborate a little bit more.
I always was interested in this topic and stock still am, regards for putting up.
A round of applause for your blog article.Thanks Again.
Thanks!
Helpful info.
Great site. Plenty of helpful information here.
Useful piece of information!
Your writing is great:)
Awesome post! I will keep an on eye on your blog.
Thanks
How to install SSL certificates for Nginx on Ubuntu…
Installing SSL certificates for Nginx is a bit different than Apache but it’s not that hard. Instead of re-eventing the wheel, check out the post on the personal blog of AfterDarkMike, the CEO of After Dark Communications, Inc. How to generate an…