In the root directory create a internal
folder with:
movement.env
user.env
auth.env
transaction.env
docker-compose up
<aside>
💡 The Nginx container is named webserver
</aside>
docker exec -it webserver bin/bash
Then have to update utils tools of debian, run this 3 commands
apt-get update
apt-get install sudo
sudo apt-get install nano
And finally update the /etc/nginx/conf.d/default.conf
to accept service URLs
#Add outside of http
upstream user {
zone upstream-user 64k;
least_conn;
server user-service:3000 max_fails=3 fail_timeout=60 weight=1;
}
upstream auth {
zone upstream-auth 64k;
least_conn;
server auth-service:3001 max_fails=3 fail_timeout=60 weight=1;
}
upstream transaction {
zone upstream-transaction 64k;
least_conn;
server transaction-service:3002 max_fails=3 fail_timeout=60 weight=1;
}
upstream images {
zone upstream-images 64k;
least_conn;
server images-service:3003 max_fails=3 fail_timeout=60 weight=1;
}
#Inside of http/server
location /api/user {
proxy_pass <http://user/user>;
default_type "application/json";
rewrite ^/user/?(.*)$ /$1 break;
}
location /api/auth {
proxy_pass <http://auth/auth>;
default_type "application/json";
rewrite ^/auth/?(.*)$ /$1 break;
}
location /api/transaction {
proxy_pass <http://transaction/transaction>;
default_type "application/json";
rewrite ^/transaction/?(.*)$ /$1 break;
}
location /api/images {
proxy_pass <http://images/images>;
default_type "application/json";
rewrite ^/images/?(.*)$ /$1 break;
}