# Any resources?

**URL:** <https://www.ruby-forum.com/t/any-resources/84117>\
**Category:** Deployment\
**Created:** [February 1, 2007, 4:01pm UTC](https://www.ruby-forum.com/t/any-resources/84117 "2007-02-01T16:01:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [February 1, 2007, 4:01pm UTC](https://www.ruby-forum.com/t/any-resources/84117/1 "2007-02-01T16:01:15Z")

</div>

Hi,

first off, wanted to congratulate (spelled correctly?) ruby-forum for  
opening this new ‘Rails - deployment’ forum; it’s been long on my list  
of “the-sun-will-shine” list and so congrats for the new step up. 🙂

pretty simple question i should think, but does anyone know of some link  
/ resource / blog explaing using https:// with nginx and mongrel  
clusters? i understood that even if i passed some ssh\_module via nginx,  
i still need to config mongrel as well (?) … does anyone know of some  
good place to learn to do this?

tia,

s

---

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [February 1, 2007, 4:09pm UTC](https://www.ruby-forum.com/t/any-resources/84117/2 "2007-02-01T16:09:31Z")

</div>

On 2/1/07, harper [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> first off, wanted to congratulate (spelled correctly?) ruby-forum for  
> opening this new ‘Rails - deployment’ forum; it’s been long on my list  
> of “the-sun-will-shine” list and so congrats for the new step up. 🙂

Credit should really go to Robby at Planet Argon for starting the  
Google Group 🙂

> pretty simple question i should think, but does anyone know of some link  
> / resource / blog explaing using https:// with nginx and mongrel  
> clusters? i understood that even if i passed some ssh\_module via nginx,  
> i still need to config mongrel as well (?) … does anyone know of some  
> good place to learn to do this?

Mongrel doesn’t know/care what SSL is. There’s nothing to configure  
on that end.

–  
Rick O.  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [February 2, 2007, 3:40am UTC](https://www.ruby-forum.com/t/any-resources/84117/3 "2007-02-02T03:40:44Z")

</div>

On Feb 2, 12:01 am, harper [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> pretty simple question i should think, but does anyone know of some link  
> / resource / blog explaing using https:// with nginx and mongrel  
> clusters?

I’m trying to keep some up-to-date nginx information on [  
[http://zh.stikipad.com/notes/show/nginx](http://zh.stikipad.com/notes/show/nginx) ]. There are also links to ML,  
Wiki, articles etc. Maybe will help you.

---

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [February 2, 2007, 2:16am UTC](https://www.ruby-forum.com/t/any-resources/84117/4 "2007-02-02T02:16:38Z")

</div>

Harper,

This should help you:

- Typical Configurations Overview For Nginx HTTP(S) Reverse Proxy/Web  
No Mongrel stuff but the “Using nginx as https-enabled web server” and  
“Using nginx as reverse-proxy server before some another web-serve”  
should do it, remember that Mongrel is just a web server.  
Serverhttp://blog.kovyrin.net/2006/04/17/typical-nginx-configurations/

- Using Tracd with Nginx in Cluster Mode  
No Rails Stuff but it has a recipe for “Nginx + SSL”  
[TracNginxRecipe – The Trac Project](http://trac.edgewall.org/wiki/TracNginxRecipe)

- nginx + ssl + rails  
[http://notrocketsurgery.com/articles/2006/11/02/ngnix-ssl-rails](http://notrocketsurgery.com/articles/2006/11/02/ngnix-ssl-rails)

- New Nginx.conf with optimizations

> From the Nginx - Rails Guru Ezra, “This conf also includes a second  
> vhost for ssl that points to the same mongrel cluster so you can  
> hanlde ssl and non ssl with the same cluster and rails request.ssl?  
> helper will work correctly.”  
> [Ruby on Rails Blog / What is Ruby on Rails for?](http://brainspl.at/articles/2007/01/03/new-nginx-conf-with-optimizations)

And I have read that list of nginx has a really good support, but  
haven’t tried myself.

–  
Aníbal Rojas

> **[RUBYCORNER.COM](https://www.rubycorner.com/)**
>
> RUBYCORNER.COM - Contact us for any business inquiries

> **[Home - Has Many Developers](https://hasmanydevelopers.com/)**
>
> We are the best choice for your building design and development

---

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [February 4, 2007, 1:04pm UTC](https://www.ruby-forum.com/t/any-resources/84117/5 "2007-02-04T13:04:41Z")

</div>

hi all && many thanks.

very helpful. i’ve already managed to raise the whole app i need to ssl,  
so that all of the content in my site (as well as the store partion,  
which is really the only part in ssl i need) is in the https protocol.

thing is, i’ve just learned that ssl works according to the ip of the  
server, and not the server\_name; this is fine, except, i’m running  
six-seven rails apps on the same server (one ip) [#vhosts#] and so  
whenever i do [https://one-of-these-apps/](https://one-of-these-apps/) it redirects to the specific  
app i put the ssl\_configuration into.

example →

[http://www.octava.co.il/](http://www.octava.co.il/) # goes to octava (good)  
[https://www.achia.co.il/](https://www.achia.co.il/) # goes to achia in ssl (good)  
[https://www.octava.co.il/](https://www.octava.co.il/) # goes to achia in ssl (bad)

this is a broader problem of the fact that i’d like to confine the  
https:// to a certain part of the application (only the store partion,  
not the content part) and not according to the whole app. (certainly not  
according to the whole ip of the server either).

so if i have a mongrel instance running on /var/www/achia, how do i  
setup the nginx.conf to give https support only to the store portion of  
the app and NOT to any other parts of the app / other apps on the  
server? (i.e, only part of the controllers in the achia app).

either way, thanks for all the above help.  
oh, and thanks to Robby@Planet-Argon. good catch.

-s

---

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [February 4, 2007, 7:55pm UTC](https://www.ruby-forum.com/t/any-resources/84117/6 "2007-02-04T19:55:07Z")

</div>

Hi Harper,

The easiest (and probably best) solution would be to get a second IP  
for your box, and switch your non-ssl sites to it.

As for confining ssl to certain sections of your site, it’s probably  
best done through your application. Write a before\_filter that checks  
to see if the request is using ssl, and redirect if appropriate.

Ex:

before\_filter :redirect\_to\_ssl

def redirect\_to\_ssl  
if(request.env[‘HTTPS’] != “ON”)  
redirect\_to request.env[‘REQUEST\_URI’].sub(/^http/i, “https”)  
end  
end

before\_filter :no\_ssl

def no\_ssl  
if(request.env[‘HTTPS’] == “ON”)  
redirect\_to request.env[‘REQUEST\_URI’].sub(/^https/i, “http”)  
end  
end

– Wes
