返回介绍

Webfunny 前端监控系统

Webfunny 埋点系统

Nginx 代理配置

发布于 2023-08-08 23:14:10 字数 4356 浏览 0 评论 0 收藏 0

写在最前头:如果使用代理,请支持双协议,http、https均要支持哈;
 
注意:监控系统只是运行代码,是否支持https,需要运维同学在你们的服务器上配置https证书,配置好证书,就可以支持https了。(只有域名才可以支持https)
 
常见问题:很多同学配置好了https证书,但是上报接口用的还是http。webfunny的探针是根据监控项目的网址来判断的,你的项目地址用的是https,上报接口也会切换到https

http {

  map $http_upgrade $connection_upgrade {
    default upgrade;
     ''   close;
  }

  #用80端口代理8011,8010两个端口号(可支持http)
  server {
    listen 80;
    server_name www.xxx.com;
    root /home/jiang/webWorks/website;
    index /home.html;

    #### 应用中心(center)服务的反向代理 ####
    location /wfManage/ {
        proxy_pass http://123.123.123.123:8009/wfManage/;
        proxy_connect_timeout 3000;
        proxy_send_timeout 3000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    location /webfunny_center/ {
      proxy_pass http://123.123.123.123:8008/webfunny_center/;
      proxy_redirect default ;
    }
  
    #### 监控系统(monitor)服务的反向代理 ####
    location /server/ {
        proxy_pass http://123.123.123.123:8011/server/;
        proxy_connect_timeout 3000;
        proxy_send_timeout 3000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    location /webfunny/ {
      proxy_pass http://123.123.123.123:8010/webfunny/;
      proxy_redirect default ;
    }

    #### 埋点系统(event)服务的反向代理 ####
    location /tracker/ {
        proxy_pass http://123.123.123.123:8015/tracker/;
        proxy_connect_timeout 3000;
        proxy_send_timeout 3000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    location /webfunny_event/ {
        proxy_pass http://123.123.123.123:8014/webfunny_event/;
        proxy_redirect default ;
    }
  }

  #用443端口代理8011,8010两个端口号(可支持https)
  server {
    listen         443 ssl;
    server_name  www.xxx.com;  #网站域名,和80端口保持一致
    root /home/jiang/webWorks;
    index /index.html;
    #          ssl             on;
    ssl_certificate /etc/nginx/cert/3120409_www.xxx.com.pem;       #证书公钥
    ssl_certificate_key  /etc/nginx/cert/3120409_www.xxx.com.key;  #证书私钥
    ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!3DES:!aNULL:!eNULL;
    ssl_prefer_server_ciphers  on;

    #### 应用中心(center)服务的反向代理 ####
    location /wfManage/ {
        proxy_pass http://123.123.123.123:8009/wfManage/;
        proxy_connect_timeout 3000;
        proxy_send_timeout 3000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    location /webfunny_center/ {
      proxy_pass http://123.123.123.123:8008/webfunny_center/;
      proxy_redirect default ;
    }
  
    #### 监控系统(monitor)服务的反向代理 ####
    location /server/ {
        proxy_pass http://123.123.123.123:8011/server/;
        proxy_connect_timeout 3000;
        proxy_send_timeout 3000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    location /webfunny/ {
      proxy_pass http://123.123.123.123:8010/webfunny/;
      proxy_redirect default ;
    }

    #### 埋点系统(event)服务的反向代理 ####
    location /tracker/ {
        proxy_pass http://123.123.123.123:8015/tracker/;
        proxy_connect_timeout 3000;
        proxy_send_timeout 3000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    location /webfunny_event/ {
        proxy_pass http://123.123.123.123:8014/webfunny_event/;
        proxy_redirect default ;
    }
  }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文