Changeset - 456e1e3ce4eb
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2011-12-01 00:25:48
marcin@python-works.com
fixes #305 User guide suggests sub-optimal nginx configuration
1 file changed with 17 insertions and 8 deletions:
0 comments (0 inline, 0 general)
docs/setup.rst
Show inline comments
 
@@ -477,27 +477,36 @@ Nginx virtual host example
 

	
 
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;
0 comments (0 inline, 0 general)