0

I'm trying to include a subdomain kibana.domain.com however the proxy setup isn't working. The domain without the subdomain works, and all the redirects for no-www and ssl work for the base domain. However the subdomain kibana.example.com receives 'This site cannot be reached' by is running and versions are compatible for Kibana and Elasticsearch. Any recommendations would be helpful, thanks.

nginx.conf

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    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  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;

    server {
        listen [::]:80;
        listen 80;
        server_name example.com www.example.com;

        include snippets/letsencrypt.conf;

        return 301 https://$host$request_uri;
    }

    server {
        listen [::]:443 ssl http2;
        listen 443 ssl http2;
        server_name www.example.com;

        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
        include snippets/ssl.conf;
        include snippets/letsencrypt.conf;

        return 301 https://example.com$request_uri;
    }
    
    server {
        listen [::]:443 ssl http2;
        listen 443 ssl http2;
        server_name example.com;

        access_log   /var/log/nginx.access_log  main;

        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
        include snippets/ssl.conf;
        include snippets/letsencrypt.conf;

        index index.html index.htm;

        location / {
            root /var/www/html;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

/etc/nginx/conf.d/kibana.conf

server {
    listen [::]:80;
    listen 80;
    server_name kibana.example.com;

    return 301 https://kibana.example.com$request_uri;
}

server {
    listen [::]:443 ssl http2;
    listen 443 ssl http2;
    server_name kibana.example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/htpasswd.users;

    location / {
        proxy_pass https://localhost:5601;
        proxy_http_version 1.1;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_redirect off;
    }
}
2
  • Please clarify "does not work". What exactly are you doing? What happens? Jan 17, 2021 at 10:38
  • I've added the failing behavior, but it's unfortunately not very descriptive. I'm not even sure what logs to check, and I'm not seeing anything in my nginx error logs or systemctl journal.
    – jFasaJr
    Jan 17, 2021 at 16:53

1 Answer 1

0

This was a stupid mistake, and I thought I had already configured this in my DNS setup through digital ocean. I had neglected to verify that the subdomain had a CNAME established as an alias for the domain. There are other issues I'm now having, but it now resolves properly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .