0

I'm trying to set up a server. I got as far as the advice given on stackoverflow under the question: "Configure apache to listen on port other than 80".

But when I try to add a new <VirtualHost *:20> in sites-enabled apache2 fails to restart with an error pointing to this modification.

I tried several ways to write it (with or without a space between the colon and the port number, with or without closing tags, in default.conf and in 000-default.conf...

In default.conf there is nothing. In 000-default.conf there is <VirtualHost *:80> (not even the port 443 for https), commented out stuff and the closing tag.

And anyway it's not a virtual server, as far as I understand the word.

When I type

lsof -i -n -P | grep LISTEN

I see apache2 listening for root and for www-data on ports 20, 21, 22, 80 and 443, which is what I want (I think).

cupsd is listening for root on 2 home IPs and dnsmasq is listening for nobody on another home IP.

In the iptables, the settings are exactly the same for all 5 ports, in INPUT, FORWARD and OUTPUT. All other ports are set to DROP.

I can connect to the server with Firefox and with Konqueror via http. But when I try to connect via ftp it fails. On the terminal:

ftp 192.168.1.83
ftp: connect: Connection timed out
ftp localhost
ftp: connect: Connection refused

I downloaded FileZilla and I ran their wizard on the other computer, the one I'm trying to connect to the server. I tried both active and passive mode, whatever they are (I rtfmed but I didn't understand it). Each time it answered :

Failed to create listen socket on port 0, aborting

Not surprising, because AFAIK there's no such port. Valid ports are supposed to be from 1 to 65535.

I thought it could be a permission problem so I went to /var/www and set everything to chmod 777. Just to test, right, I then set the permissions back as they were. It didn't help anyway.

So, apache2 may be listening on port 21 but it's not talking. Please help.

1
  • Even if Apache were listening on ports 20, 21 and 22 it isn't likely to be able to handle clients that usually use those ports unless the clients are expecting a HTTP data stream.
    – Dave
    Nov 24, 2020 at 17:31

1 Answer 1

1

Apache is an HTTP daemon. FTP is rather complex in its port handling. I don't believe Apache can handle that. You need an FTP daemon, eg. vsftpd.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .