So I've found NginX's official tutorial, how to use NginX Plus as the proxy for the MariaDB Cluster. However, if I do this with my standard NginX (not the Plus edition) I constantly get the error
nginx: [emerg] invalid URL prefix in /etc/nginx/conf.d/mariadb.conf:10
Here is the config
upstream db {
server 10.0.0.101:3306;
server 10.0.0.102:3306;
server 10.0.0.103:3306;
}
server {
listen 3306;
location / {
proxy_pass db;
proxy_connect_timeout 1s;
}
}
My question if this is only available on NginX Plus or I'm doing something wrong? I'm aware, that normally I need a prefix in the proxy_pass like https://
but in this case?
You need to remove the
location / {}
stuff. This is for http servers, not for plain TCP. And you need to wrap it into astream
block.You can find the documentation here: https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/