help with ssl config nginx -> thin -> rails

Valentin V. Bartenev ne at vbart.ru
Thu Jan 12 22:29:50 UTC 2012


On Thursday 12 January 2012 22:30:43 Karl Johnson wrote:
[...]
> ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|txt|tar|mi
> d|midi|wav|bmp|rtf|ttf|woff|svg|eot)$ {
>         root   /var/www/dev/public/;
>                 expires           10y;
>                 add_header Cache-Control public;
>         }
> location ~ ^(/javascripts/.*)$ {
>         root   /var/www/dev/public/;
>                 expires           10y;
>                 add_header Cache-Control public;
>         }

Why did you put regexp captures everywhere and don't use them?

> 
>  if (-f $request_filename/index.html) {
>         rewrite (.*) $1/index.html break;
>       }
>       if (-f $request_filename.html) {
>         rewrite (.*) $1.html break;
>       }
>       if (!-f $request_filename) {
>         proxy_pass http://developmentmode;
>         break;
>       }

It's ugly. Please read:
http://wiki.nginx.org/IfIsEvil
http://wiki.nginx.org/Pitfalls

..and use the "try_files" directive:
http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files

[...]
> }
> }
> server {
> listen 443;
> server_name govenga.com www.govenga.com;
[...]
> proxy_pass https://devmode-secure;
[...]

and above:

> 
> upstream devmode-secure{
> server 127.0.0.1:443;
> }
> 

...looks like you set up a loopback proxy pass to nginx itself.


wbr, Valentin V. Bartenev



More information about the nginx mailing list