一般的私网用户上公网会有一个出口设备提供公网访问能力,这个设备被称为正常代理,正向代理是代理用的。与之相反代理服务器的情况被称为反向代理,即用户访问服务器时实际是向反向代理发起请求,反向代理与真正的后端服务器交互。
为了后端服务的安全
节省公网ip资源
降低后端服务器负载
下面以实际测试环境为例进行说明,两台服务器192.168.43.133充当反向代理服务器 192.168.43.132充当真正的后端业务服务器
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://192.168.43.132;
#root html;
#index index.html index.htm;
}
<!DOCTYPE html>
<html>
<head>
<title>Welcome to test_proxyed_nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to test_proxyed_nginx!</h1>
原文:https://www.cnblogs.com/flags-blog/p/14909628.html