美文网首页
nginx配置远程web页面请求本地service

nginx配置远程web页面请求本地service

作者: 得鹿梦为鱼 | 来源:发表于2018-12-25 23:39 被阅读0次

场景

前后端分离的工程,前端页面基本可用,后端人员需在本地测试一些接口。

如果使用postman进行测试,可能没有在页面上操作方便。

解决

使用nginx进行代理。

test-web 是项目的web地址;

test 是后端工程的context-path。

配置截图

    location /test-web {

           proxy_pass  http://remote-ip:port/test-web;

            index  index.html index.htm;

    }

    location /test {

            proxy_pass  http://localhost-ip:port;

     }

使用

在浏览器输入 localhost/test-web ,就像在开发环境上进行操作是一样的。但是页面请求的后台服务地址将会是你本地启动的server。

相关文章

  • nginx配置远程web页面请求本地service

    场景 前后端分离的工程,前端页面基本可用,后端人员需在本地测试一些接口。 如果使用postman进行测试,可能没有...

  • dokcer 搭建 php+nginx 开发环境

    启动php 其中 ~/workspace/www 是本地目录,用来放web页面 nginx 配置文件 创建本地配置...

  • nginx本地配置web项目-layui

    nginx安装配置以及配置本地web项目 nginx下载和安装介绍 nginx(engine x) 是一个高性能的...

  • Service workers

    Service worker 用js控制页面请求的资源Service workers 本质上充当Web应用程序与浏...

  • centos6.6 install tengine lua

    tengine-lua shell 脚本安装 nginx配置文件 server 主机配置 web页面访问 fpm打...

  • nginx基础

    一、请求nginx默认页面 1、流程 二、nginx.conf配置 listen 监听端口。server_name...

  • nginx负载均衡配置

    nginx负载均衡配置 配置环境 本地配置三台docker容器分别命名为web1、web2、和Qd(前端机),we...

  • tengine-lua 安装

    shell 脚本安装 nginx配置文件 server 主机配置 web页面访问 fpm打包 目录结构 脚本 命令安装

  • ssh 快捷登录

    效果 登录阿里云 机器 本地机器:macOS远程机器:120.25.83.123 配置 本地配置 远程配置 本地快...

  • 使用本地文件调试线上代码-Chrome开发者工具override

    overrides可以将远程的页面下载到本地, 在下一次请求该页面时可以用本地页面进行替换显示。主要用于调试css...

网友评论

      本文标题:nginx配置远程web页面请求本地service

      本文链接:https://www.haomeiwen.com/subject/kcfclqtx.html