Hello forum:

I am trying to make apache an ftp server. I think this is possible because apache has mod_ftp.
Below is a snippet of my httpd.conf file that has the configuration for a virtual host to serve as an ftp server:

LoadModule ftpd_module modules/mod_ftpd.so
LoadModule ftpd_default_module modules/mod_ftpd_default.so

NameVirtualHost 192.168.x.x

Listen 21
<VirtualHost *:21>
FtpProtocol On
FtpAllowActive Off
ServerName ftp.myboxdomain.com or IP
DocumentRoot /var/www/html/ftpdocs
<Directory /var/www/html/ftpdocs>
# AuthName "FTP Server"
# AuthType Basic
# AuthUserFile /etc/httpd/conf/passwd/.htpasswd
# Require valid-user
Order allow,deny
# Allow from all
Allow from 192.168.x.x

Now the following is my host file on my linux box:
# Do not remove the following line, or various programs
# that require network functionality will fail. localhost.localdomain localhost
192.168.x.x www.myhostname.com myhostname
192.168.x.x ftp.192.168.x.x or IPaddress

If there is a solution someone can help me find, please let me know. I have been working on this for three days, and I just do not get it right. I also wonder if I have to use an ftp server like proFTPD along with apache.

I am running Apache/2.0.59 (CentOS) Server.

Recommended Answers

All 43 Replies

the best way to go is to set up a normal ftp server besides Apache. these things are to be used as intended.

here is the description: http://incubator.apache.org/ftpserver/

since this is a java written thing, I wouldn't get near it for performance.

commented: Dima is a very helpful member. +1

Hello Dima Yasny:

I went to that site before, but I did not
find it useful. When you say to set up a
normal ftp server besides Apache, do
you mean I need to have an ftp server,
like proFTP running, together with the apache
ftp virtual directory?

There has to be a way to achieve this.
I just want users to be able to upload
and download files via a browser. Just
like I would download winzip for example.


the ftp will have nothing to do with the apache VD. it's just a service. if you want it's name to be known as ftp.domain.com instead of www.domain.com you just need to add the ftp.domain.com A record to your DNS

OK. I will keep working on this until I get it sometime. Have you ever got this working
under apache? I mean, making apache an
ftp server as well as a web server?


I have set up many linux servers with apache as http server and vsftpd/proftpd/wu-ftpd as ftp servers

apache is NOT and ftp server though.

Ok. That is a good site. If you look at my first post, it is really about the same
thing I have configured in the apache virtual server.

Now, I think this is the way I should do things.

1) Configure an ftp virtual server like the one I have.
2) Have an ftp daemon running like vsftpd or proftpd.
3) Create accounts for vsftpd or proftd or whatever daemon I am using.

Can you suggest me about a server name for the ftp virtual host.
I am not doing DNS for this one, I am just editing my /etc/hosts file
accordingly like I posted.

Thanks a lot for your insights and your time on this.

can you, in detail, describe what exactly you want the server to do?

I want to get apache running as an ftp server. I am not sure, however, if I need an ftp daemon like proftpd running along with the apache ftp virtual directory. I want users to upload and download files via a browser. Let us say I create a directory /home/ftpdocs. Then my document root would be /home/ftpdocs.

I want apache to display, via a browser, whatever files users upload to that particular directory on the server as well as be able to download those files.

Like I said, I do not know if I need a separate ftp daemon running or just apache with the ftp virtual directory.

Thanks a lot.

apache can display and browse through files in a directory. I think that is enabled by default. so if you point it to the ftp root - it will display everything and let you click and download the files there. that is the default setting really.

any ftp daemon can be pointed to the same directory for ftp access, and clients will be able to put/get files there through ftp, and then browse the directory over http (which is provided by apache)

the only question is what authentication are you looking at?

I am looking for basic authentication.
Users would be allow to have read-only acces while
files are on the server. However, they would be able
to modify those files once they have downloaded them.

I really apreciate your help. I do not have much experience
working with apache ( 5 months only ).

I have a question. How would you make the ftp daemon
point to the directory where the files are?

I think I only seen that feaute in the proftpd.conf file only.
Do all others like vsftpd and wu-ftpd have that option?


of course, all of them can be configured to point to an arbitrary directory in the FS and even be chrooted.
and if the read only browsing with a web browser will not need authentication you're basically ok to go with the default settings of apache

Ok Dima. This is the deal for now. I will keep working according to your instructions. I am heading home now because I have been working on this since Monday, and I am not
myself anymore. I am kind of anxious because of this.

I would like to know if we can continue working on this together either tomorrow or whenever you have some time. This is really a work assignment. However, I also want to get this through even if the company changes plans since this is teaching me a lot about both apache and ftp. I have never worked with ftp before.

I hope we can come back to this again.
Thanks Dima.

will, since it is past midnight now and I have to work tomorrow, I will be able to help you tomorrow, if I have the time

anyhow, a good idea would be to get onto howtoforge.com - there are lots of ftp step by step guides there

Hello Everyone:

I am still working on doing ftp uploads/downloads via a browser. As we all can see, Dima has been guiding me through parts of the process. If anyone else would love to join us, please come aboard.


Thanks Dima. I am going to check that out.
I will post whatever solution we can get out of this.


Hello Anyone:

I have installed pure-ftpd on my centos linux
box. However, I am looking for the configuration
file to configure it. I think it does not have one.
Does it? Please let me know.

Also, if it does not have a configuration file, then
how I can configure it?


Hello Dima and all others in the forum team:

I am still working on my ftp server setup.
Yes, I know it has been a few days, but I need
to get this working.

Now I have a question for anyone who can help. What does
getnameinfo failed means after I run the command: netstat -a | grep ftp ?
I am running the pure-ftpd server on port 21.

I have looked online, but I really do not find an explanation to the problem.
Thanks guys.

Hello again guys:

Another thing that I have found out is that according to the apache documentation,
you need to be running apache 2.3 in order to enable apache with ftp capabilities.
I am currently running 2.2.3 and I do not find apache 2.3 with apache 2.2.6 being
the latest version out.

Therefore, I have temporarily discarded that apache possibility. My plan now is to
get and ftp server running and use a client, graphical or web client, to upload/download

I will post a step-by-step solution to this ordeal for those who I have not done this before
find it less painful or not painful at all (ideally).

I invite you to visit these sites for more info:



Thanks guys.

Hello Everyone:

Tonight is Tequila/Budweiser/Rum or whatever
medicine you bring to the table night. Dima, all others, I finally got that ftp server working.

I really appreciate all of your help.

Now this is the thing, I will post the steps I took
to find a solution by tomorrow. I am going to documented tonight. Please bear with me.

However, there is just another question I have for you all. When I ftp on my browser, this is what I see:

FTP root at ftp.IP
To view this FTP site in Windows Explorer, click Page, and then click Open FTP Site in Windows Explorer.

03/15/2007 12:00AM Directory pub


How would I go about solving this so I can see my ftp documents instead?


can you ftp from the proper ftp client?

Yes, I can ftp from the proper ftp client.

However, another problem.

How can I create accounts for the ftp server,
I am using vsftpd, so that users can only login
to the ftp server via a client, but not to my linux
box where the server lives?


what is the client backend? unix users, sql, tdb?

Hello Dima:

I really do not know what do you mean
by the client backend.
I am running the server from a linux (CentOS)
box. The client would upload/download via a
graphical ftp client like SmartFTP.


are you using the linux internal clients to authenticate to ftp?

I am not sure I understand what you mean by
linux internal clients. Please excuse me for that
one. I have never worked on ftp servers before.

This is what I am using. I am using the SmartFTP
client graphical interface to login to the ftp server. The ftp-user accounts were created as follows:

groupadd ftpusers
mkdir /home/ftpdocs
chmod 750 /home/ftpdocs
chown root.ftpusers /home/ftpusers
chown root.ftpusers /home/ftpdocs useradd -g
ftpusers -d /home/ftpdocs ftpuser1
passwd ftpuser1

I created a directory ftpdocs where all ftp documents are. ftpuser1 is the ftp user. The problem is that with this account ftpuser1 can log in to my linux box that also has a web server
running. This is something that I do not want ftpuser1 to be able to do.

I have the following in the vsftpd.conf file:
# (default follows)

And the following in the chroot_list file:

I do not know if this would help solve the problem. Thanks.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.