• nginx 代理http配置实例


    #user  nginx;
    worker_processes  5;
    
    #error_log  /var/log/nginx/error.log warn;
    #pid        /var/run/nginx.pid;
    
    
    events {
        worker_connections  10240;
    }
    
    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  0;
        keepalive_timeout  65;
    
        #gzip  on;
    
       upstream Jq_one{
        #server 192.168.11.175:8090;
        #server 192.168.11.192:8090;
        server  zh.hainan.gov.cn;
        #server  10.34.1.31;
        }
    
        server {
            listen       90;
            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       91;
            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       92;
            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;
    
           } 
    
    }
    
    
    
    
    }
  • 相关阅读:
    redis系列:分布式锁
    Netty实现高性能IOT服务器(Groza)之手撕MQTT协议篇上
    DelayQueue
    java内置锁实现锁住代码块方案(同一个对象或锁住整个类.class)
    Java的类加载机制
    数据库事务特性ACID
    MQ关于实现最终一致性分布式事务原理解析
    数据库分库分表容量划分建议参考阿里云DRDS原则
    异常解决:Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    OpenResty 简介
  • 原文地址:https://www.cnblogs.com/ruiy/p/8392122.html
Copyright © 2020-2023  润新知