Nginx之什么是反向代理(一)

什么是反向代理?

反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给internet上请求连接的客户端,此时代理服务器对外就表现为一个反向代理服务器。

启动一个Tomcat 127.0.0.1:8080

使用nginx反向代理 8080.anyan.com 直接跳转到127.0.0.1:8080

Host文件新增

127.0.0.1 8080.anyan.com

127.0.0.1 8081.anyan.com

nginx.conf 配置

server {

        listen       80;

        server_name  8080.anyan.com;

        location / {

            proxy_pass  http://127.0.0.1:8080;

            index  index.html index.htm;

        }

    }

     server {

        listen       80;

        server_name  8081.anyan.com;

        location / {

            proxy_pass  http://127.0.0.1:8081;  

            index  index.html index.htm;

        }

    }

猜你喜欢

转载自www.cnblogs.com/hzanyan/p/11973785.html