3、nginx设置简单的代理服务器-阅读官方文档

官网:Beginner’s Guide

翻译部分: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 / {
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值