<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.nginx.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.nginx.org/index.php?title=RubyonRailsMongrel&amp;feed=atom&amp;action=history</id>
		<title>RubyonRailsMongrel - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.nginx.org/index.php?title=RubyonRailsMongrel&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://wiki.nginx.org/index.php?title=RubyonRailsMongrel&amp;action=history"/>
		<updated>2013-05-22T20:06:57Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.0</generator>

	<entry>
		<id>http://wiki.nginx.org/index.php?title=RubyonRailsMongrel&amp;diff=43&amp;oldid=prev</id>
		<title>Towynlin: changed false to off in proxy_redirect</title>
		<link rel="alternate" type="text/html" href="http://wiki.nginx.org/index.php?title=RubyonRailsMongrel&amp;diff=43&amp;oldid=prev"/>
				<updated>2011-09-14T03:54:42Z</updated>
		
		<summary type="html">&lt;p&gt;changed false to off in proxy_redirect&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Ruby on Rails / Mongrel =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;geshi lang=&amp;quot;nginx&amp;quot;&amp;gt;&lt;br /&gt;
user  deploy;&lt;br /&gt;
worker_processes  1;&lt;br /&gt;
error_log   logs/error.log debug;&lt;br /&gt;
&lt;br /&gt;
events {&lt;br /&gt;
  worker_connections  1024;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
http {&lt;br /&gt;
  include        conf/mime.types;&lt;br /&gt;
  default_type   application/octet-stream;&lt;br /&gt;
  sendfile        on;&lt;br /&gt;
  #tcp_nopush     on;&lt;br /&gt;
  keepalive_timeout  65;&lt;br /&gt;
  tcp_nodelay        on;&lt;br /&gt;
&lt;br /&gt;
  gzip  on;&lt;br /&gt;
  gzip_min_length  1100;&lt;br /&gt;
  gzip_buffers     4 8k;&lt;br /&gt;
  gzip_types       text/plain;&lt;br /&gt;
&lt;br /&gt;
  upstream mongrel {&lt;br /&gt;
    server 127.0.0.1:8000;&lt;br /&gt;
    server 127.0.0.1:8001;&lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  server {&lt;br /&gt;
    listen       80;&lt;br /&gt;
    server_name  example.com;&lt;br /&gt;
    root         /var/www/apps/example/current/public;&lt;br /&gt;
    index        index.html index.htm;&lt;br /&gt;
    &lt;br /&gt;
    try_files  $uri/index.html $uri.html $uri @mongrel;&lt;br /&gt;
    &lt;br /&gt;
    location @mongrel {&lt;br /&gt;
      proxy_set_header  X-Real-IP        $remote_addr;&lt;br /&gt;
      proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;&lt;br /&gt;
      proxy_set_header  Host             $http_host;&lt;br /&gt;
      proxy_redirect    off;&lt;br /&gt;
      proxy_pass        http://mongrel;&lt;br /&gt;
    }&lt;br /&gt;
    error_page   500 502 503 504  /50x.html;&lt;br /&gt;
    location = /50x.html {&lt;br /&gt;
      root   html;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/geshi&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
== Multiple mongrel instances? ==&lt;br /&gt;
Never run only a single mongrel instance, Rails is not thread safe. 90% of the time you need to run TWO in order to get any level of acceptable performance.&lt;br /&gt;
&lt;br /&gt;
== proxy_redirect? ==&lt;br /&gt;
I noticed on some apps that redirections break.  It seems it was stripping the proxy_pass from the redirection url:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;geshi lang=&amp;quot;nginx&amp;quot;&amp;gt;&lt;br /&gt;
upstream beast { ... }&lt;br /&gt;
proxy_pass http://beast;&lt;br /&gt;
&amp;lt;/geshi&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In my rails production log I see &amp;quot;Redirected to http://beast.caboo.se/login&amp;quot;.  However, livehttpheaders only sees '.caboo.se/login'.  Adding the proxy_redirect false; above fixes it.&lt;/div&gt;</summary>
		<author><name>Towynlin</name></author>	</entry>

	</feed>