Remote FTP backup connection refused for custom FTP port like. 821

i add remote ftp backup details successfully with custom ftp port 821. but, after create backup with command line get error
ftp: connect to address ::1: Connection refused
successfully connect if try with php ftp login.

// connect to FTP server
$ftp_server = "localhost";
$port = "821";
$ftp_username = "abc";
$ftp_userpass = "123";

$ftp_conn = ftp_connect($ftp_server, $port) or die("Could not connect to $ftp_server");

// login
if (@ftp_login($ftp_conn, $ftp_username, $ftp_userpass))
  echo "Connection established.";
  echo "Couldn't establish a connection.";

// close connection

why get this error?

  • localhost:821 is cloudflared remote host tunnel.

Hestia Control Panel: v1.6.11
Operating System:Debian 10.10 (x86_64)

Try manualy to connect using ftp cli, nothing hestia can resolve.

Check if port 821 is open in the firewall and ftp is listing to that port

Probally this is not the case…

Also localhost means and does not go trough Cloudflare…

yes after use work fine with sftp port 22.
but, not work with ftp port 21. ask for password and login success… but, stuck at “Retrieving directory listing”…
i know this is not hestiacp problem. but your small help save my time.
thank you @ScIT and @eris :heart:

Status:	Initializing TLS...
Status:	TLS connection established.
Status:	Logged in
Status:	Retrieving directory listing...
Command:	PWD
Response:	257 "/" is the current directory
Command:	TYPE I
Response:	200 Switching to Binary mode.
Command:	PASV
Response:	227 Entering Passive Mode (192,168,2,2,46,255).
Command:	LIST
Error:	Connection timed out after 20 seconds of inactivity
Error:	Failed to retrieve directory listing