springcloud版本如何访问druid监控后台

Blade 未结 3 1467
迷途小书童
迷途小书童 剑圣 2021-04-09 09:54
悬赏:5
下面是druid配置文件和nginx配置文件信息,我需要怎么做才能访问到druid后台监控页面

#spring-datasource配置
spring:
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    druid:
      initial-size: 5
      max-active: 20
      min-idle: 5
      max-wait: 60000
      validation-query: SELECT 'x'
      # Oracle校验
      #validation-query: select 1 from dual
      validation-query-timeout: 2000
      test-on-borrow: false
      test-on-return: false
      test-while-idle: true
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
      stat-view-servlet:
        enabled: true
        login-username: blade
        login-password: blade
      web-stat-filter:
        enabled: true
        url-pattern: /*
        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
        session-stat-enable: true
        session-stat-max-count: 10
      filters: stat






#user  nobody;

worker_processes  1;


error_log  logs/error.log;

error_log  logs/error.log  warn;

#error_log  logs/error.log  info;


pid        logs/nginx.pid;



events {

    worker_connections  1024;

}



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  off;


    sendfile        on;

    #tcp_nopush     on;


    keepalive_timeout  65;


    #gzip  on;

    

    upstream gateway { 

    server 127.0.0.1:8080;

    }


    server {

        listen 8000;

        server_name web;

        root html;

        location / {

        

        }

        location ^~/api {

        proxy_set_header Host $host;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_buffering off;

        rewrite ^/api/(.*)$ /$1 break;

        proxy_pass http://gateway;

    }

    }

client_max_body_size 100m;

}


3条回答
  • 2021-04-09 14:29

    放开某个服务的端口,访问这个服务ip+端口/druid/index.html就可以了

    作者追问:2021-04-09 17:27

    用你的方法404,不知道是哪的问题

    image.png

    3 讨论(0)
  • 2021-12-15 14:28

    我也遇到同样问题,想知道如何查看cloud版本的druid ?

    0 讨论(0)
  • 2022-03-11 12:49

    相同的问题

    0 讨论(0)
提交回复