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

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

server {
    listen 20;
    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?

  • 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

nginx can do SMTP/POP3/IMAP:

aswell as HTTP:

and the PROXY protocol:

Maybe you can use a custom module to support ftp:

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


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

  • 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.