Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a standard Rails 2.3.11 install, with passenger and nginx. I've correctly installed the SSL certificates and they are confirmed to work. However, I only need SSL on two paths and I`m not sure how to accomplish this in the nginx.conf file. The rest of the site, including all assets should go over normal http.

Does anyone have any tips on how to achieve this?

share|improve this question
up vote 1 down vote accepted

You don't do it in your nginx.conf, you do it in your app. Whatever you want to go over HTTPS you make https:// links, and everything else is an http:// link. There are plugins for Rails that'll allow you to declare what pages must be SSL-protected, and redirect if necessary (I've used ssl_requirement in the past, but it's probably this week's hawtness).

If you try to redirect things in your nginx.conf, all that you're going to do is annoy users with "Some content on this page is unencrypted" warnings whenever they access an HTTPS page.

share|improve this answer
That is what I got when I forced a redirect to https in nginx.conf, it did not show the certificate as verified. I had an idea that doing this on server level would be more efficient for some reason, but if there is no real downside to doing it in the rails app I will surely have a look at the gem you mentioned and do some browsing about it. – amunds Jul 21 '11 at 3:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.