翻译部分:Setting Up a Simple Proxy Server
开始!
One of the frequent uses of nginx is setting it up as a proxy server, which means a server that receives requests, passes them to the proxied servers, retrieves responses from them, and sends them to the clients.
nginx的一个常见用途是将其设置为代理服务器,这意味着代理服务器接收请求,并将其转发给被代理服务器,从被代理服务器得到响应后将响应发送回给客户端(即浏览器)。
We will configure a basic proxy server, which serves requests of images with files from the local directory and sends all other requests to a proxied server.
我们将配置一个基本的代理服务器,该服务器使用本地目录中的文件服务图像请求,并将其他所有请求发送到被代理服务器。
In this example, both servers will be defined on a single nginx instance.
在这个例子中,两个服务器都将被定义在一个单独的nginx实例上。
First, define the proxied server by adding one more
server
block to the nginx’s configuration file with the following contents:
server { listen 8080; root /data/up1; location / { } }