listen 80;
server_name localhost; # 访问"localhost"的全部请求会被转发到"localhost:81"
# localhost => localhost:81
# localhost/a/ => localhost:81/a/
# localhost/b/ => localhost:81/b/
location / {
proxy_pass http://localhost:81;
} # 访问"localhost"的全部请求会被转发到"localhost:81/a/"
# localhost => localhost:81/a/
# localhost/a/ => localhost:81/a/a/
# localhost/b/ => localhost:81/a/b/
location / {
proxy_pass http://localhost:81/a/;
} # 访问"localhost/c/"的全部请求会被转发到"localhost:81/a/"
# localhost => 不会转发
# localhost/c/ => localhost:81/a/
# localhost/c/aa/ => localhost:81/a/aa/
location /c/ {
proxy_pass http://localhost:81/a/;
} # 访问"localhost/api/"的全部请求会被转发到"localhost:81"
# localhost => 不会转发
# localhost/api/ => localhost:81
# localhost/api/a/ => localhost:81/a/
# localhost/api/b/ => localhost:81/b/
location /api/ {
# rewrite 的作用是修改URI
rewrite ^/api(/.*)$ $1 break;
proxy_pass http://localhost:81;
} # http://localhost/api/ => http://127.0.0.1:81/
# http://localhost/api/a/ => http://127.0.0.1:81/a/
# http://localhost/api/b/ => http://127.0.0.1:81/b/
# http://localhost/api/?path=/a => http://127.0.0.1:81/a
# http://localhost/api/?path=/b => http://127.0.0.1:81/b
location /api/ {
if ($arg_path = '') {
rewrite ^/api(/.*) $1 break;
set $arg_path $1;
}
proxy_pass http://127.0.0.1:81$arg_path;
}

nginx proxy的更多相关文章

  1. nginx proxy超时报错 upstream timed out (110: Connec...

    环境介绍 服务器:centos6.4服务:nginx proxy 问题描述: 然后查找  /opt/usr/nginx/1.4.0/logs  错误 error.log日志提示如下 2015/01/0 ...

  2. Nginx+proxy实现简单的负载均衡

    环境说明:操作系统centos6.6 64位web操纵系统是:web1=192.168.10.10(LAMP) web2=192.168.10.11(LNMP),这里只是测试nginx实现负载均衡效果 ...

  3. Keepalivaed +Nginx proxy 高可用架构方案与实施过程细节

    1.开源产品介绍 1)CMS介绍 官方网站http://www.dedecms.com/,是一个网站应用系统构建平台,也是一个强大的网站内容管理系统,既可以用来构建复杂的体系的企业信息门户或者电子商务 ...

  4. [Node] Setup an Nginx Proxy for a Node.js App

    Learn how to setup an Nginx proxy server that sits in front of a Node.js app. You can use a proxy to ...

  5. nginx proxy大文件上传失败问题总结

    问题描述: http://www.syhuo.net ota.apk包上传正常 http://www.syhuo.net:8080 ota.apk包上传不正常 查看nginx error日志 [roo ...

  6. nginx proxy pass redirects ignore port

    nginx proxy pass redirects ignore port $host in this order of precedence: host name from the request ...

  7. Docker Nginx-Proxy 容器Nginx Proxy反向代理

    Docker Nginx-Proxy 容器Nginx Proxy反向代理   简单介绍 Docker容器的自动Nginx反向代理   dockerhub地址 https://hub.docker.co ...

  8. nginx proxy优化

    常用优化要点 当nginx用于反向代理时,每个客户端将使用两个连接: 一个用于响应客户端的请求,另一个用于到后端的访问: 如果机器是两核CPU,例如: 1 2 $ grep ^proces /proc ...

  9. haproxy + nginx + proxy protocol 获得客户真实IP方法

    公司网站架构为: 前面2台HA负载均衡,后面3台Nginx负载均衡反向代理,然后后面有N台WEB服务器 由于要统计IP,需要在WEB服务器日志里体现客户端真实IP 那么问题来了,通过HA代理的HTTP ...

  10. nginx proxy模块

    环境: user:192.168.100.169 nginx代理:192.168.100.175 tomcat:192.168.100.175 域名:www.vijay.com  --->192 ...

随机推荐

  1. new() 和 make() 的区别 var arr1 = new([5]int) var arr2 [5]int

    Effective Go - The Go Programming Language https://golang.org/doc/effective_go.html#allocation_new A ...

  2. Vue技术点整理-vue.config.js

    1,proxy代理解决本地开发环境跨域问题 配置proxy代理后,proxy会将任何未知请求 (没有匹配到静态文件的请求) 代理到 https://192.168.3.49:8080 vue.conf ...

  3. oracle 常用语法()

    一ORACLE的启动和关闭 1在单机环境下 2在双机环境下 Oracle数据库有哪几种启动方式 1startup nomount 2startup mount dbname 3startup open ...

  4. Phoenix简介概述,Phoenix的Java API 相关操作优秀案例

    Phoenix简介概述,Phoenix的Java API 相关操作优秀案例 一.Phoenix概述简介 二.Phoenix实例一:Java API操作 2.1 phoenix.properties 2 ...

  5. Django (auth模块、User对象、用户认证、线上-用户认证)

    一.auth模块 django.contrib.auth中提供了许多方法,这里主要介绍其中的三个: authenticate()    提供了用户认证,即验证用户名以及密码是否正确,一般需要usern ...

  6. Java获取类路径的方式

    Java环境中,如何获取当前类的路径.如何获取项目根路径等: @Test public void showURL() throws IOException { // 第一种:获取类加载的根路径 Fil ...

  7. linux常用命令(shell脚本常用命令)(grep、cut、sort、uniq、seq、tr、basename、dirname)

    本章命令: 1 2 3 4 5 6 grep cut sort uniq seq tr 1.grep 作用:过滤文本内容 选项 描述 -E :--extended--regexp 模式是扩展正则表达式 ...

  8. 3.centos 7执行service iptables save报错问题

    1.报错 [root@localhost ~]# service iptables save The service command supports only basic LSB actions ( ...

  9. 23.centos 7配置网络

    1.ifconfig:查看网卡信息   如果centos7 最小化安装没有ifconfig这个命令,可以使用yum install net-tools 来安装. centos7 网卡命名规则:  en ...

  10. 跟着Vimtutor学习Vim

    跟着Vimtutor学习Vim Lesson 1 1.1 移动光标 在Vim中移动光标,分别使用h.j.k.l键代表左.下.上.右方向. 1.2 退出VIM :q! <ENTER> 退出V ...