How to access Nginx inside LXD container from host system?

I’m currently working on a project using LXD, Elasticsearch, Logstash, and Nginx as a reverse proxy for accessing Kibana.

I’m having a bit of trouble trying to access a Nginx instance running inside my LXD container.

I’ve tried the following without success:

I’m able to access services running in the LXD container on the Ubuntu host inside VirtualBox. However, I do not have connectivity to the LXD container from my physical machine (MacBook).

Ideally, I’d like to be able to give each LXD container an IP address on my LAN, which should allow me to ssh into each container and access Nginx, Kibana, etc., from my physical machine (MacBook).

I hope the following information is useful. If more info is needed, just let me know.

Thank you for reading!

The Nginx config inside the LXD container is:

server {
    listen 80 default_server;
    server_name _;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 default_server ssl http2;
 
    server_name _;
 
    ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
    ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
    ssl_session_cache shared:SSL:10m;
 
    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/htpasswd.kibana;
 
    location / {
        proxy_pass http://localhost:5601;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Would allowing the promiscuous mode in the VBox settings do any good?

I remember that was mentioned somewhere,when I had a similar problem

That’s a good question. I know it would allow communication between VMs, but not sure if that opens up access to the LXD bridge and all private networking between the physical system and the LXD containers.

it couldn’t cause any damage to at least try it and see what happens I guess.

If it works.you can still figure out whether umwanted side effects could result from that.