nginx konfiguration mit reverse proxy und Grafana als Subdomain

  • Hi,


    folgendes möchte ich gern realisieren:


    Webserver Nginx mit Reverse Proxy und SSL zu einer Subdomain.meinedomain.de die dann auf Grafana zeigt.

    Aslo ich gebe im Browser https://subdomain.meinedomain.de ein und werde zu Grafana geleitet.


    So sieht meine virtualHostDatei-subdomain-meinedomain.de aus:


    server {

    # Config

    server_name subdomain.meinedomain.de;

    access_log /var/log/nginx/subdomain.meinedomain.de.log main;

    root /home/subdomain.meinedomain.de;

    index index.php index.html index.htm;


    # Proxy Grafana.

    location / {

    proxy_pass http://localhost:3000;


    }


    # Error Pages

    error_page 403 /403.html;

    location = /403.html {

    root /home/subdomain.meinedomain.de/error-page;

    }

    error_page 404 /404.html;

    location = /404.html {

    root /home/subdomain.meinedomain.de/error-page;

    }

    error_page 500 /500.html;

    location = /500.html {

    root /home/subdomain.meinedomain.de/error-page;

    }

    error_page 502 /502.html;

    location = /502.html {

    root /home/subdomain.meinedomain.de/error-page;

    }

    error_page 503 /503.html;

    location = /503.html {

    root /home/subdomain.meinedomain.de/error-page;

    }

    error_page 504 /504.html;

    location = /504.html {

    root /home/subdomain.meinedomain.de/error-page;

    }


    # Modules

    location ~ \.php$ {

    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

    fastcgi_index index.php;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    include fastcgi_params;

    }



    listen [::]:443 ssl; # managed by Certbot

    listen 443 ssl; # managed by Certbot

    ssl_certificate /etc/letsencrypt/live/subdomain.meinedomain.de/fullchain.pem; # managed by Certbot

    ssl_certificate_key /etc/letsencrypt/live/subdomain.meinedomain.de/privkey.pem; # managed by Certbot

    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


    }

    server {

    if ($host = subdomain.meinedomain.de) {

    return 301 https://$host$request_uri;

    } # managed by Certbot



    listen 80;

    listen [::]:80;

    server_name subdomain.meinedomain.de;

    return 404; # managed by Certbot


    und meine Grafana.ini sieht so aus:


    [server]

    # Protocol (http, https, h2, socket)

    ;protocol = http


    # The ip address to bind to, empty will bind to all interfaces

    http_addr = IPmeinesServers


    # The http port to use

    ;http_port = 3000


    # The public facing domain name used to access grafana from a browser

    #domain = subdomain.meinedomain.de


    # Redirect to correct domain if host header does not match domain

    # Prevents DNS rebinding attacks

    ;enforce_domain = false


    # The full public facing url you use in browser, used for redirects and emails

    # If you use reverse proxy and sub path specify full url (with sub path)

    root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/



    Jedoch komme ich einfach nicht zum Ergebnis ???? Bekomme immer eine 404Fehlermeldung


    Gruss Torsten