No, you have to separate each configuration file for your needs. You may define container IP addresses as statically in nginx, proxy_pass http://<container_IP>:80;
Please, make a simple test environment and then try like that way.
Put every configuration as a file in /etc/nginx/conf.d directory.
Gobetween is now in maintenance mode though so someone should probably just write some generic program for haproxy / nginx / apache / whatever else is in these days.
Hi @Ibragim_Ganizade, I havent investigate your configuration in detail but I have configured a simple configuration for your needs as explained in your diagram.
Here is the config.
Install the haproxy on the host.
Create lxd instances/containers.
To test purposes install nginx or any service to test. (Here I used nginx.)
In the host haproxy configuration (/etc/haproxy/haproxy.cfg), and restart service.
Your case AlpineLinux, or in any container.
apk add nginx
rc-update add nginx default
rc-service nginx start
mkdir -p /var/www/app3
cd /var/www/app3
echo āThis is a test page. APP3.ā > index.html
And in your nginx configuration, change default configuration a little bit in the /etc/nginx/http.d directory as below. After configuration changes reload with nginx -s reload. And test it.
# This is a default site configuration which will simply return 404, preventing
# chance access to any other virtualhost.
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/app3;
# Everything is a 404
location / {
index index.html;
# return 404;
}
# You may need this to prevent return 404 recursion.
location = /404.html {
internal;
}
}
P.S. You can watch your requests on haproxy as stated in the configuration on port 8181.
Regards.
Actually no. , as I mentioned before when you launch a container you can trigger a small script to organize/add configuration automagically. The concept is same, if i follow you correctly the backend executes small python like services, right?
Regards.
the first link that you posted is the right solution for you. Just need to do right nginx config. I tried it and it was working well.
I was looking at gobetween, however from documentation the lxd configuration is for loadbalancing at specific port e.g 80 or 12345 in default configuration, and not for solution that you expect.