# Do I need Apache for a simple web-server?



## astralfx (Jun 6, 2011)

What I'm trying to do is, allow someone on the local network to connect to my IP and access a file.

E.g. some random user connects and downloads from me: 192.168.2.10/file.doc

Do I need Apache to allow the user, to download the file from the directory.

Is there any other way of downloading the file, from my local IP.
I tried: 192.168.2.10/home/Astral/file.doc But that's obviously wrong, what's the best minimal installation of something to allow this simple task -__-


----------



## DutchDaemon (Jun 6, 2011)

Apache may be a bit much for that. Try something way smaller like www/lighttpd. And without further configuration, any webserver will allow anyone to access/download any file under its DocumentRoot, so no special configuration will be needed.


----------



## SirDice (Jun 6, 2011)

No ports are needed either as the file could easily be downloaded using SSH/scp or even FTP.


----------



## vermaden (Jun 6, 2011)

@astralfx

... or even use python directly:

```
% [color="Blue"]cd ${HOME}/dir/with/that/file[/color]
% [color="#0000ff"]python -m SimpleHTTPServer 8080[/color]
Serving HTTP on 0.0.0.0 port 8080 ...
```

and send him link to your box: http://10.20.30.40:8080 from where anyone will be able to download this file, as You would not longer need it, You would just stop that python process.


----------



## DutchDaemon (Jun 6, 2011)

Ok, use net/netcat then


----------



## wblock@ (Jun 6, 2011)

nc(1) is in base, but I agree with SirDice on scp(1).  Or net/rsync, which is the same thing only better.  A web browser is probably better suited for unsophisticated, er, fenestrated users.


----------



## DutchDaemon (Jun 6, 2011)

@wblock, yes, I tend to forget about netcat being nc every time I need it. I think I'll just alias it.


----------



## astralfx (Jun 6, 2011)

I tried netcat but I spent too long faffing about, the Python script was so much simpler & easier.

Thanks vermaden.


```
import SimpleHTTPServer
import SocketServer

PORT = 1337

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "Running HTTP server @ port: ", PORT
httpd.serve_forever()
```


----------



## astralfx (Jun 6, 2011)

Also is there a way to get a really simple FTP server running. I found this.

http://www.mythi.cx/python/pyFTPdrop.py

However found out it was UPLOAD only .. I need "download" mainly, however "upload" would also be nice :/

Any scripts which are really simple, I have no desire for security or whatever, just a really simple script/tool to allow any user on network to download a file via FTP from my machine 

(Before you may ask "Why", I have my reasons. Windows CMD shell can only get files via FTP, and I don't have the luxury of installing tools such as wget on there machines, so need to stick to the basics of getting files via CLI)

_______________________________________________________________________________________
Edit: Nevermind, found one and edited it to my liking..


----------



## SirDice (Jun 7, 2011)

astralfx said:
			
		

> Any scripts which are really simple, I have no desire for security or whatever, just a really simple script/tool to allow any user on network to download a file via FTP from my machine


Just enable the standard FTP service. Add to /etc/rc.conf:

```
ftpd_enable="YES"
```

And start it:
`# service ftpd start`


----------

