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. 一个cgi的例子

    cgi的详细资料可以参考 http://httpd.apache.org/docs/2.4/howto/cgi.html 下面是一个python实现的cgi脚本,里面体现了一些cgi的用法,使用其他脚 ...

  2. Flutter环境搭建遇坑小结(一)

    对flutter的了解与开发也有一段时间了,总的来说,搭建开发环境遇到的各种坑也是很多,尤其对于初次接触Android开发的人员来说 一.flutter运行提示Running Gradle task ...

  3. (24)bzip2命令:压缩文件(.bz2格式)&&bunzip2命令:bz2格式的解压缩命令

    1.bzip2 命令同 gzip 命令类似,只能对文件进行压缩(或解压缩),对于目录只能压缩(或解压缩)该目录及子目录下的所有文件.当执行压缩任务完成后,会生成一个以".bz2"为 ...

  4. poj3252 Round Numbers (数位dp)

    Description The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, P ...

  5. hdu1541 Stars

    Problem Description Astronomers often examine star maps where stars are represented by points on a p ...

  6. WPF 主动触发依赖属性的 PropertyChanged

    需求背景 需要显示 ViewModel 中的 Message/DpMessage,显示内容根据其某些属性来确定.代码结构抽象如下: // Model public class Message : IN ...

  7. 使用开源量子编程框架ProjectQ打印编译后的量子线路与绘制线路图

    技术背景 在量子计算领域,基于量子芯片的算法设计(或简称为量子算法)是基于量子线路来设计的,类似于传统计算中使用的与门和非门之类的逻辑门.因此研究一个量子线路输入后的编译(可以简化为数量更少的量子门组 ...

  8. k8s二进制部署 - flannel安装

    安装Flannel [root@hdss7-21 ~]# cd /opt/src/ [root@hdss7-21 src]# wget https://github.com/coreos/flanne ...

  9. Hexo准备---Node.js、Vue

    Hexo准备---Node.js.Vue 安装node.js 1.下载node 配置node.js环境官网下载,一直next就好,非常方便. 下载官网: http://nodejs.cn/downlo ...

  10. 关于malloc/free用法

    和很多人一样,我一直觉得new/delete和malloc/free的用法很随意,直到我真正遇到了麻烦,才想着去好好区分一下. (1)首先mallo函数原型void* malloc(size_t).头 ...