nginx(windows)实现反向代理

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_38861828/article/details/102734625

环境:开发环境(本地)

nginx基本概念

nginx是什么,有什么用,和tomcat有什么关系,反向代理和正向代理有什么区别

修改hosts文件

在C:\windows\system32\drivers\etc\hosts文件中添加 域名与主机IP 映射

修改nginx配置文件

在nginx-1.12.2\conf\nginx.conf中添加

server {
        listen       80;
        server_name  nongmall.com;

        location / {
            proxy_pass http://127.0.0.1:8081;
        }
    }

nginx更多配置

测试

1.项目部署到tomcat

2.启动 127.0.0.1:8081 端口下的tomcat服务

3.用浏览器访问

    

可见 域名nongmall.com 访问到了127.0.0.1:8081 端口下的服务

nginx(windows)实现反向代理的流程图

猜你喜欢

转载自blog.csdn.net/qq_38861828/article/details/102734625