changeset 1745:456e1e3ce4eb beta

fixes #305 User guide suggests sub-optimal nginx configuration
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 01 Dec 2011 01:25:48 +0200
parents d41a115d9a39
children 753aeb4a5c58
files docs/setup.rst
diffstat 1 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/docs/setup.rst	Thu Dec 01 00:40:28 2011 +0200
+++ b/docs/setup.rst	Thu Dec 01 01:25:48 2011 +0200
@@ -477,27 +477,36 @@
 
 Sample config for nginx using proxy::
 
+    upstream rc {
+        server 127.0.0.1:5000;
+        # add more instances for load balancing
+        #server 127.0.0.1:5001;
+        #server 127.0.0.1:5002;
+    }
+    
     server {
        listen          80;
        server_name     hg.myserver.com;
        access_log      /var/log/nginx/rhodecode.access.log;
        error_log       /var/log/nginx/rhodecode.error.log;
+
        location / {
-               root /var/www/rhodecode/rhodecode/public/;
-               if (!-f $request_filename){
-                   proxy_pass      http://127.0.0.1:5000;
-               }
-               #this is important if you want to use https !!!
-               proxy_set_header X-Url-Scheme $scheme;
-               include         /etc/nginx/proxy.conf;  
+            try_files $uri @rhode;
        }
+    
+       location @rhode {
+            proxy_pass      http://rc;
+            include         /etc/nginx/proxy.conf;
+       }
+
     }  
   
 Here's the proxy.conf. It's tuned so it will not timeout on long
 pushes or large pushes::
-
+    
     proxy_redirect              off;
     proxy_set_header            Host $host;
+    proxy_set_header            X-Url-Scheme $scheme;
     proxy_set_header            X-Host $http_host;
     proxy_set_header            X-Real-IP $remote_addr;
     proxy_set_header            X-Forwarded-For $proxy_add_x_forwarded_for;