Welcome! Log In Create A New Profile

Advanced

nginx as proxy to my mysql server in docker

Posted by douglasjam 
nginx as proxy to my mysql server in docker
March 19, 2016 03:19PM
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;
}
}
Re: nginx as proxy to my mysql server in docker
March 20, 2016 06:46AM
i just discovery that is not possible with other protocols to handle dns names, ill just use port redirection provided by docker
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 107
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready