5

I'm trying to set-up a simple ftp proxy using Nginx. Right now my configuration is like this:

server {
    listen 21;
    server_name 52.49.13.91;
    location / {
        proxy_pass ftp://my.ftpsite.com/;
    }
}

server {
    listen 20;
    server_name 52.49.13.91;
    location / {
        proxy_pass ftp://my.ftpsite.com/;
    }
}

But i got the following error from nginx: invalid URL prefix in /etc/nginx/sites-enabled/ftp-proxy:5

Is nginx even capable to do this? How can I achieve this?

4
  • First of all, read up on FTP passive mode. Next, because a “native” FTP proxy needs access to the command stream, it does not support encryption. The question is: What are you actually trying to achieve? Making some FTP host appear as if it were hosted on your domain? – Daniel B Aug 15 '15 at 15:41
  • What I'm trying to achieve is to connect from my computer to a FTP host that only accepts connections from a specific ip address that I can control. – Antoine M. Aug 17 '15 at 5:48
  • 1
    I see. In that case, I recommend using a SOCKS proxy. – Daniel B Aug 17 '15 at 7:50
  • You might look into using the mod_proxy module for ProFTPD, which creates an FTP proxy. (Note that I'm the author.) – Castaglia Dec 22 '17 at 17:04
3

nginx can do SMTP/POP3/IMAP:
https://www.nginx.com/resources/admin-guide/mail-proxy/

aswell as HTTP:
https://www.nginx.com/resources/admin-guide/reverse-proxy/

and the PROXY protocol:
https://www.nginx.com/resources/admin-guide/proxy-protocol/
http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt

Maybe you can use a custom module to support ftp:
https://github.com/yaoweibin/nginx_tcp_proxy_module

But by default nginx doesn't support FTP as proxy protocol.

0

Use upstream nginx module. It can upstream tcp streams. But you will need describe all ports in config - command and data.

1
  • 4
    Can you go into some more detail on how you think this will work? Please take our tour and see How to Answer. – Burgi Sep 3 '18 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.