Home > OS >  Is it possible to redirect FTP requests to another IP using NGINX?
Is it possible to redirect FTP requests to another IP using NGINX?

Time:06-26

I have two linux VMs with IPs 192.168.1.10 - VM1 and 192.168.1.11 - VM2. NGINX is running in VM1. VM2 is ftp server. I can successfully upload files to 192.168.1.11:21.

What I am trying to achieve is, instead of using the IP of VM2, is it possible to use IP of VM1 to upload files using nginx?

EDIT

I am looking for something like below;

upstream ftp_server {
    server 192.168.1.11:21 fail_timeout=0;
}
server {
}

CodePudding user response:

I think you want to forward a TCP stream to another server. So something like this should work for you:

stream {
    upstream backend {
        server 192.168.1.11:21;
    }

    server {
        listen 21;
        proxy_pass backend;
    }
}

CodePudding user response:

of I want to redirect to different ips depending the domain user want connect, it is possible? Dom1.com to server 193.168.0.8:22 Dom2.com to server 193.168.0.8:21

....

Thanks.

  • Related