Introduction: Quicky Web Server for Linux.
Here are several examples of quick ways to set up a web server. I like to use the the python web server for quickly downloading files between computer systems be it they are workstations, laptops, touchpads/tablets. or etc. The computers involved must be connected to a network via tcpip or it will not work. Unconnected computers will not work. Note: you could use a crossover cable between two machines via tcpip protocol. Warning: this method is not secure!!
Note: Using nweb or the python web server are good for tow resource machines.
Step 1: Set Up.
Most all linux systems come with python or if not you can easily download and install it. Actually you might be able to do this on an mswindows machine, but I have not tried it.
1. Go to command line and cd to the directory you want to serve.
(in my case it would be cd arranged.
2. Find out the IP address of the machine you are on with ifconfig.
3. While in that directory type in without quotes "python -m SimpleHTTPServer".
You should see something like this
python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
localhost - - [21/Oct/2010 11:11:43] "GET / HTTP/1.1" 200 -
localhost - - [21/Oct/2010 11:11:43] code 404, message File not found
localhost - - [21/Oct/2010 11:11:43] "GET /favicon.ico HTTP/1.1" 404 -
localhost - - [21/Oct/2010 11:11:46] code 404, message File not found
localhost - - [21/Oct/2010 11:11:46] "GET /favicon.ico HTTP/1.1" 404 -
^CTraceback (most recent call last):
File "/usr/lib/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
File "/usr/lib/python2.6/SimpleHTTPServer.py", line 218, in
File "/usr/lib/python2.6/SimpleHTTPServer.py", line 214, in test
File "/usr/lib/python2.6/BaseHTTPServer.py", line 588, in test
File "/usr/lib/python2.6/SocketServer.py", line 224, in serve_forever
r, w, e = select.select([self], , , poll_interval)
That is it for this machine.
Step 2: Access the Server.
Now you want to go to the machine you want to download the files to.
1. Open up your web browser and type In the url type in the ipaddress you found in the last step with :8000 added on the end, then press enter (that is just the port being used instead of the usual port 80.)
2. You should see the directory of the host computer. if there is an index.htm(l) file in that directory it will be displayed instead of the directory. (you will need to rename it if you just want to download files.
Viola, you done. Now you can download files if you need to.
Note: you could also write a simple web page to obly show the files you wanted for downloading.
Step 3: Quicky Lamp Server Install on Ubuntu
TRY THIS AT YOUR OWN RISK:
Here the simple steps for install 'LAMP-server' using "tasksel"in ubuntu 10.10 from the command line.
Open your terminal and follow the following commands.
1. sudo apt-get install tasksel
2. sudo tasksel install lamp-server
3. "set your 'MYSQL Password"
4. sudo gedit /var/www/phpinfo.php (Add the following mini php code in this file) Or use vim, nano or etc from the command line.
5. sudo /etc/init.d/apache2 restart
Now, lets check if LAMP-Server was installed correctly. (if you have a gui installed) otherwise go to another machine and point the browser to the ip address of your web server.
Open your browser and type in the url http://localhost
And now lets check if php is working http://localhost/phpinfo.php
That's all. Enjoy and feel free to Ask.
Step 4: Nweb (static Files Only).
$ mkdir nweb
$ cd nweb
Download and extract the tar file
$ tar zxvf es-nweb.tar
$ gcc nweb.c -o nweb
nweb port [directory} and run in background:
(I just used the current directory for testing)
$ nweb 8181 . &
Point to it from a browser. Actually I used the web directory on my existing web server to see what I would get.).
$ mkdir /home/nag/webpages $ cd /home/nag/webpages $ cp /tmp/nweb.tar . $ tar xvf nweb.tar $ ls client.c index.html nigel.jpg nweb.c nweb_AIX51 nweb_RedHat9_pentium nweb_SuSE_SLES8_PowerPC $ chmod ugo+x nweb $ chmod ugo+r *.html *.jpg $ nweb 8181 /home/nag/webpages &More information here and the download at:
Step 5: Openbsd
While Openbsd is not linux, it is a nix derivative. The reason why I added this steo is that you can install the latest version of Openbsd (5.2 at the time of this step's creatation) on a really old machine. The web page shown is from a pentium one computer with 128 meg ram and a 4 gig hard drive as storage. You can actially install openbsh on the old machines with just floppies and the help of the internet.
The apache web server somes built into the default install of open bsd. You can start it with:
$ sudo /usr/sbin/apachectl start
The main web directory is at: /var/www/htdocs/. You can also add theamp stack too.
Step 6: Nweb
Nweb is almost simple if you are not afraid to compile a program on linux. More information at: http://www.ibm.com/developerworks/systems/library/es-nweb/index.html