nginx(windows)实现反向代理

别说谁变了你拦得住时间么 提交于 2019-12-02 08:49:40

环境:开发环境(本地)

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)实现反向代理的流程图

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!