I'm working with a server in the cloud with N dockers containers, in the server I have one nginx that redirect based on the domain to my docker containers, I can perfectly redirect my http traffic, but I'm getting troubles with when it is mysql since it uses a protocol different to http, I tried some solutions like below but didn't work, can someone give me one light where is my mistake?
upstream mysql {
server 127.0.0.1:1401;
}
server {
listen 80;
server_name mydomain.com.br www.mydomain.com.br;
location / {
proxy_pass http://127.0.0.1:1400;
}
}
server {
listen 3306;
server_name mydomain.com.br www.mydomain.com.br;
location / {
proxy_pass mysql;
}
}
I already saw this page (https://www.nginx.com/resources/admin-guide/proxy-protocol/), but did not work when i try to define the server_name / domain:
stream {
server {
listen 12345;
proxy_pass example.com:12345;
proxy_protocol on;
}
}
upstream mysql {
server 127.0.0.1:1401;
}
server {
listen 80;
server_name mydomain.com.br www.mydomain.com.br;
location / {
proxy_pass http://127.0.0.1:1400;
}
}
server {
listen 3306;
server_name mydomain.com.br www.mydomain.com.br;
location / {
proxy_pass mysql;
}
}
I already saw this page (https://www.nginx.com/resources/admin-guide/proxy-protocol/), but did not work when i try to define the server_name / domain:
stream {
server {
listen 12345;
proxy_pass example.com:12345;
proxy_protocol on;
}
}