~udienz/nginx/nginx.head

« back to all changes in this revision

Viewing changes to debian/help/docs/upstream

  • Committer: Mahyuddin Susanto
  • Date: 2010-12-03 19:16:59 UTC
  • Revision ID: udienz@gmail.com-20101203191659-lcce9wyzm25dlhfc
Tags: 0.8.53-2
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##
 
2
#  File:
 
3
#    upstream
 
4
#  Description:
 
5
#    This file describes how to use upstream blocks.
 
6
##
 
7
 
 
8
An upstream block allows you to set a list of upstream locations for both
 
9
proxy_pass and fastcgi_pass directives.
 
10
 
 
11
Examples of upstream blocks:
 
12
 
 
13
# PHP listening on the same server
 
14
upstream php {
 
15
        # ip_hash ensures the same backend is used for client reconnects.
 
16
        ip_hash;
 
17
        # This assumes we have multiple PHP listeners on different known ports.
 
18
        server 127.0.0.1:9000;
 
19
        server 127.0.0.1:9001;
 
20
        server 127.0.0.1:9002;
 
21
        server 127.0.0.1:9003;
 
22
        # In addition to listening on ports, we can listen to unix sockets.
 
23
        server unix:/tmp/php-cgi.socket;
 
24
}
 
25
 
 
26
# Multiple backend Apache instances on separate servers
 
27
upstream apache {
 
28
        # Adding a weight alters the chance the upstream server will be used.
 
29
        server apache1.domain.com weight 5;
 
30
        server apache2.domain.com;
 
31
        server apache3.domain.com;
 
32
        # Adding 'down' keeps the upstream from being used. Useful for downtime management.
 
33
        server apache4.domain.com down;
 
34
        server apache5.domain.com;
 
35
}
 
36
 
 
37
Using an upstream location:
 
38
 
 
39
# Passing PHP to upstream
 
40
location ~ \.php$ {
 
41
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
 
42
        include fastcgi_params;
 
43
        fastcgi_pass php;
 
44
}
 
45
 
 
46
# Passing all requests for /cgi-bin/* to Apache upstreams.
 
47
location /cgi-bin {
 
48
        proxy_pass apache;
 
49
}
 
50
 
 
51
For more information see http://wiki.nginx.org/HttpUpstreamModule