• nginx 端口转发


    nginx 端口转发
    当有 HTTP 请求到来时,将 HTTP 请求的 HOST 等信息与其配置文件进行匹配并转发给对应的服务。

    nginx 请求 转发到 tomcat

    nginx 配置参考 :

    http { server { server_name test.com; location
    /server1/ {
    # 请求转发指向的是 server1 目录; proxy_pass http:
    //test.com:8080/; } location /admin/ { proxy_pass http://test.com:8080/admin/; } location / { proxy_pass http://test.com:80; } } }

    tomcat - webapps 存放 server1 服务;
    -- webapps
    -- server1


    nginx 端口转发:

    # 配置负载均衡池
    # server1 负载均衡
    upstream server1 {
        server 127.0.0.1:8081;
    }
    
    # server2 负载均衡 upstream server2 { server
    127.0.0.1:8082; } #server1 端口转发 server { listen 80; server_name server1.test.com; access_log logs/server1.log; error_log logs/server1.error; #将所有请求转发给 server1 的应用处理 location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://server1; } }
    # server 2 端口转发 server { listen
    80; server_name server2.test.com; access_log logs/server2.log; error_log logs/server2.error; #将所有请求转发给 server2 池的应用处理 location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://server2; } }

    地址转发:

    server {
        listen 80;
        server_name zabbix.test.com;
        access_log /opt/ngxlog/emzabbix.access.log main;
        error_log /opt/ngxlog/emzabbix.error.log;
    
        #root /opt/server/zabbix;
        #index index.php;
        
        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://172.16.6.219:8088/zabbix/;
            }
       }
  • 相关阅读:
    react脚手架和JSX
    promise
    防抖和节流
    call/apply/bind 用法
    js this指向
    vue单页面应用刷新网页后vuex的state数据丢失的解决方案
    Echarts基础
    继承
    原型链
    vue项目中使用生成动态二维码
  • 原文地址:https://www.cnblogs.com/sharesdk/p/11152465.html
Copyright © 2020-2023  润新知