寫在前面提醒:使用代理,如果可以,請盡量支持雙協議,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;#### 應用中心be反向代理location /wfManage/ {proxy_pass http://127.0.0.1:8011/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;}#### 應用中心fe反向代理location /webfunny_center/ {proxy_pass http://127.0.0.1:8010/webfunny_center/;proxy_redirect default ;}#### 監控系統be反向代理location /server/ {proxy_pass http://127.0.0.1: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;}#### 監控系統fe反向代理location /webfunny/ {proxy_pass http://127.0.0.1:8010/webfunny/;proxy_redirect default ;}#### 埋點系統be反向代理location /tracker/ {proxy_pass http://127.0.0.1:8011/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;}#### 埋點系統fe反向代理location /webfunny_event/ {proxy_pass http://127.0.0.1:8010/webfunny_event/;proxy_redirect default ;}}#用443端口代理8011,8010兩個端口號,可支持httpsserver {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;#### 應用中心be反向代理location /wfManage/ {proxy_pass http://127.0.0.1:8011/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;}#### 應用中心fe反向代理location /webfunny_center/ {proxy_pass http://127.0.0.1:8010/webfunny_center/;proxy_redirect default ;}#### 監控系統be反向代理location /server/ {proxy_pass http://127.0.0.1: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;}#### 監控系統fe反向代理location /webfunny/ {proxy_pass http://127.0.0.1:8010/webfunny/;proxy_redirect default ;}#### 埋點系統be反向代理location /tracker/ {proxy_pass http://127.0.0.1:8011/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;}#### 埋點系統fe反向代理location /webfunny_event/ {proxy_pass http://127.0.0.1:8010/webfunny_event/;proxy_redirect default ;}}
}
以上是webfunny<Nginx代理配置>操作介紹, ps: 如果你是前端工程師的相關技術同學,歡迎試用體驗**【webfunny前端監控和埋點系統】**