SSL certificate installation on Ubuntu/Nginx

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.


Share
You can leave a response, or trackback from your own site.

31 Responses to “SSL certificate installation on Ubuntu/Nginx”

  1. Dozal Demers says:

    Remarkable things here. I am very glad to see your article. It solved a simple task for me.

  2. Hilborn says:

    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.

  3. Peter says:

    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?

  4. Mattsen says:

    Valuable information. Lucky me I found your website accidentally, and I am stunned why this coincidence did not came about earlier! I bookmarked it.

  5. Arendt says:

    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!

  6. [...] 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 [...]

  7. Randhawa says:

    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

  8. Lucas Brandstrom says:

    Posted your post, “SSL certificate installation on Ubuntu/Nginx | Mike Johnson’s Personal Blog” on facebook. Regards, Lucas Brandstrom

  9. Costantino says:

    excellent layout!

  10. 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!

  11. Symmonds says:

    Hi! This is my first visit to your blog you have done a extraordinary job!

  12. Lynott says:

    Being a site owner, I thought I would give a quick comment to say I like the style and design and information here.

  13. Evalyn Ekas says:

    Hey! I just would like to give a huge thumbs up for the great layout.

  14. Valiente says:

    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.

  15. Ellerbe says:

    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

  16. Stivanson/ says:

    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!

  17. Neri says:

    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!

  18. Stroy says:

    I like the valuable information you provide to your articles.

  19. Chance says:

    Found your website through Google. You know I will be subscribing to your feed.

  20. Marisa says:

    Thank you a lot for sharing this!

  21. Jamey Loury says:

    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.

  22. Kimbriel says:

    I always was interested in this topic and stock still am, regards for putting up.

  23. Raina Dower says:

    A round of applause for your blog article.Thanks Again.

  24. AfterDarkMike says:

    Thanks!

  25. Seth Reifler says:

    Helpful info.

  26. Padlo says:

    Great site. Plenty of helpful information here.

  27. Ruggieri says:

    Useful piece of information!

  28. Ma says:

    Your writing is great:)

  29. Francisco says:

    Awesome post! I will keep an on eye on your blog.

  30. 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…

Leave a Reply

Comments links could be nofollow free.

Twitter Delicious Facebook Digg Stumbleupon Favorites More