In the LNMP development process, we often configure the nginx, and we will set similar like this

1
2
3
upstream php-fpm {
    server php-fpm:9000;
}

and I want to know what does upstream here mean.

Up stream and Down stream

So basically it’s about dependency, the Nginx server depend on PHP server to return back data. So PHP server is upstream of Nginx.

The Browser is depending on the Nginx server to return back data, so Nginx server is upstream of Browser.

On the other hand, Browser is downstream of Nginx server, because the data from Nginx will flow into the Browser, same as PHP, DB.

A production process is very similar to a river, so it’s easy to grasp that as the process goes from one step to the next, we’re moving downstream.

We can deduct the following rules:

  • Dependency Rule: each item depends on all the items upstream from its viewpoint
  • Value Rule: moving downstream, each step adds more value to the product