#user  nginx;
worker_processes ; #error_log /var/log/nginx/error.log warn;
#pid /var/run/nginx.pid; events {
worker_connections ;
} http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout ;
keepalive_timeout ; #gzip on; upstream Jq_one{
#server 192.168.11.175:;
#server 192.168.11.192:;
server zh.hainan.gov.cn;
#server 10.34.1.31;
} server {
listen ;
server_name 10.34.1.21; #charset koi8-r; #access_log logs/host.access.log main; #location / {
# root html;
# index index.html index.htm;
#}
#my own location
location / {
proxy_pass http://Jq_one;
#proxy_pass http://localhost;
#proxy_redirect / /ahyc/Web_Water/;
#proxy_redirect default;
root html;
index index.aspx index.html index.htm; #修改主页为index.aspx
#其中jq_one 对应着upstream设置的集群名称 #设置主机头和客户端真实地址,以便服务器获取客户端真实IP
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }} #第二个port app test;
upstream ahwater_portal{
server 10.34.1.31;
}
server {
listen ;
server_name 10.34.1.21;
location / {
proxy_pass http://ahwater_portal;
root html;
index index.aspx index.html index.htm; #修改主页为index.aspx
#其中jq_one 对应着upstream设置的集群名称 #设置主机头和客户端真实地址,以便服务器获取客户端真实IP
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }}
#第二个port app test;
upstream ahwater_portal2{
server 10.2.1.221;
}
server {
listen ;
server_name 10.34.1.21;
location /{
proxy_pass http://ahwater_portal2;
root html;
index index.aspx index.html index.htm; #修改主页为index.aspx #其中jq_one 对应着upstream设置的集群名称 #设置主机头和客户端真实地址,以便服务器获取客户端真实IP
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } }

nginx 代理http配置实例的更多相关文章

  1. Nginx反向代理websocket配置实例

    最近有一个需求,就是需要使用 nginx 反向代理 websocket,经过查找一番资料,目前已经测试通过,本文只做一个记录 复制代码 代码如下: 注: 看官方文档说 Nginx 在 1.3 以后的版 ...

  2. Nginx 线上配置实例

    1 /etc/nginx/nginx.conf,在主配置下设置 /etc/nginx/conf.d/*.conf user nginx;worker_processes 1; error_log /v ...

  3. nginx代理路径配置总结

    一.发现问题 配置nginx代理的时候,发现location配置的路径和代理的上下文路径的组合不同,服务端接收到的uri的路径不同,导致了controller的RequestMapping匹配出现问题 ...

  4. 单机部署minio,设置Nginx代理,配置https(TLS)访问

    安装 下载地址:https://dl.min.io/ # 创建目录 mkdir -p /usr/local/minio/{data,bin,etc} # 下载minio wget https://dl ...

  5. Nginx负载均衡配置实例

    面对高并发的问题,企业往往会从两个方面来解决.其一,从硬件上面,提升硬件的配置,增加服务器的性能:另外,就是从软件上,将数据库和WEB服务器分离,使数据库和WEB服务器都能够充分发挥各自的性能,并且二 ...

  6. Nginx负载均衡与反向代理的配置实例

    user www www; worker_processes 10; error_log /data1/logs/nginx_error.log crit; pid /usr/local/webser ...

  7. Nginx反向代理websocket配置实例(官网)

    https://www.nginx.com/blog/websocket-nginx/ Blog Tech Rick Nelson of NGINX, Inc.   May 16, 2014   NG ...

  8. Nginx负载均衡配置实例详解

    负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法,希望对有需要的同学有所帮助哦. 负载均衡 先来简单了解一下什么是负载均衡,单从字面上的意思来理解就可 ...

  9. Nginx负载均衡配置实例详解(转)

    负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法,希望对有需要的同学有所帮助哦. 负载均衡 先来简单了解一下什么是负载均衡,单从字面上的意思来理解就可 ...

随机推荐

  1. matlab save 命令

    有时候要运行很长才得到结果,而这部分结果在后面修改代码之后不需要改变.可以多次利用这些结果or参数,有必要将结果保存下来. 1 save example1 A ;%A为当前环境下的变量,example ...

  2. 软件包 com.baidu.location

    http://developer.baidu.com/map/loc_refer/index.html?com/baidu/location/package-summary.html

  3. 关于dyld: Library not loaded

    在接入智凡迪的sdk过程中,遇到以下问题: dyld: Library not loaded: @rpath/SDKFramework.framework/SDKFramework   Referen ...

  4. WIN7下配置和使用解压缩版MYSQL

    最近mysql出了新的GA版本——mysql5.6.11,此版本windows64位下只有解压缩版,于是在win7上进行了配置.期间碰到了一些问题,在此记录一下. 一.环境 操作系统:WIN764位 ...

  5. sql语句中charindex的用法

    假如你写过很多程序,你可能偶尔会碰到要确定字符或字符窜串否包含在一段文字中,在这篇文章中,我将讨论使用CHARINDEX和PATINDEX函数来 搜索文字列和字符串.我将告诉你这两个函数是如何运转的, ...

  6. CA数字加密解密Demo

    package aisin.text;    import com.google.common.collect.Maps;  import sun.misc.BASE64Decoder;  impor ...

  7. BZOJ3673 可持久化并查集 by zky 【主席树】

    BZOJ3673 可持久化并查集 by zky Description n个集合 m个操作 操作: 1 a b 合并a,b所在集合 2 k 回到第k次操作之后的状态(查询算作操作) 3 a b 询问a ...

  8. github上对一些名词的理解(之如fork)

    fork: Fork 的本义是 叉子(名词) . 比较自然的引申成 分叉(动词) ,就像上面叉子,从左到从右,一条线变成多条了. Git/GitHub 用户下面的图 来表达 Fork:分叉.克隆 出一 ...

  9. Thread和Runable实现多线程

    分析两种实现多线程的方式:Thread类和Runnable接口 写一个程序,模拟4个售票窗口共同卖100张火车票的程序. 1:使用继承Thread类方式实现(). 2:使用实现Runnable接口方式 ...

  10. webpack extract-text-webpack-plugin

    备注:  提炼上面引用的css   1. 插件配置 const path = require("path"); const extracttextplugin = require( ...