Skip to content

Commit a8c990b

Browse files
author
António P. P. Almeida
committed
* Replaced the fair algorithm for load balancing algorithm by least connection.
1 parent b4f5d73 commit a8c990b

3 files changed

+24
-15
lines changed

upstream_phpapache.conf

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
## version with the fair load balancer.
1010

1111
upstream phpapache {
12-
## If your version of Nginx doesn't have the fair load balancer:
13-
## https://github.com/gnosek/nginx-upstream-fair comment out the
14-
## following line.
15-
fair;
12+
## Use the least connection algorithm for load balancing. This
13+
## algorithm was introduced in versions 1.3.1 and 1.2.2.
14+
least_conn;
15+
1616
server 127.0.0.1:8080;
1717
server 127.0.0.1:8081;
1818
## Create a backend connection cache. Note that this requires
@@ -22,7 +22,9 @@ upstream phpapache {
2222
keepalive 5;
2323
}
2424

25-
## Add a third pool as a fallback.
25+
## Add a third pool as a fallback. Note that this requires php-cgi
26+
## side by side php-fpm. If you don't have it installed comment it
27+
## out.
2628
upstream phpapache_backup {
2729
server 127.0.0.1:8082;
2830
## Create a backend connection cache. Note that this requires
@@ -31,3 +33,4 @@ upstream phpapache_backup {
3133
## following line if that's not the case.
3234
keepalive 1;
3335
}
36+

upstream_phpcgi_tcp.conf

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
## Add as many servers as needed. Cf. http://wiki.nginx.org/HttpUpstreamModule.
1212
upstream phpcgi {
13-
## If your version of Nginx doesn't have the fair load balancer:
14-
## https://github.com/gnosek/nginx-upstream-fair comment out the
15-
## following line.
16-
fair;
13+
## Use the least connection algorithm for load balancing. This
14+
## algorithm was introduced in versions 1.3.1 and 1.2.2.
15+
least_conn;
16+
1717
server 127.0.0.1:9001;
1818
server 127.0.0.1:9002;
1919
## Create a backend connection cache. Note that this requires
@@ -23,7 +23,9 @@ upstream phpcgi {
2323
keepalive 5;
2424
}
2525

26-
## Add a third pool as a fallback.
26+
## Add a third pool as a fallback. Note that this requires php-cgi
27+
## side by side php-fpm. If you don't have it installed comment it
28+
## out.
2729
upstream phpcgi_backup {
2830
server 127.0.0.1:9003;
2931
## Create a backend connection cache. Note that this requires
@@ -32,3 +34,4 @@ upstream phpcgi_backup {
3234
## following line if that's not the case.
3335
keepalive 1;
3436
}
37+

upstream_phpcgi_unix.conf

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
## Add as many servers as needed. Cf. http://wiki.nginx.org/HttpUpstreamModule.
1212
upstream phpcgi {
13-
## If your version of Nginx doesn't have the fair load balancer:
14-
## https://github.com/gnosek/nginx-upstream-fair comment out the
15-
## following line.
16-
fair;
13+
## Use the least connection algorithm for load balancing. This
14+
## algorithm was introduced in versions 1.3.1 and 1.2.2.
15+
least_conn;
16+
1717
server unix:/var/run/php-fpm.sock;
1818
server unix:/var/run/php-fpm-zwei.sock;
1919
## Create a backend connection cache. Note that this requires
@@ -23,7 +23,9 @@ upstream phpcgi {
2323
keepalive 5;
2424
}
2525

26-
## Add a third pool as a fallback.
26+
## Add a third pool as a fallback. Note that this requires php-cgi
27+
## side by side php-fpm. If you don't have it installed comment it
28+
## out.e
2729
upstream phpcgi_backup {
2830
server unix:/var/run/php-fpm-bkp.sock;
2931
## Create a backend connection cache. Note that this requires
@@ -32,3 +34,4 @@ upstream phpcgi_backup {
3234
## following line if that's not the case.
3335
keepalive 1;
3436
}
37+

0 commit comments

Comments
 (0)