To make a "home-made" server on your computer is a very easy thing,but its tough to make it with satisfying the following requirements :
1.Without the use of Apache,IIS,Nginx,Lighttpd
2.Using open-source
3.With lot of in-built facilities
This seems like dreamy but you have another way of doing it using the world's best open-source scripting-cum-programming language Python it makes it very easy.By the way,Facebook runs mostly on Python.
If you find that you do not know much about Python,no problem.Just write the four lines below,and a "home-made" server would be built.This will help in making your computer an efficient server.
Initially,you must have Python installed.You can download it from following links,copy the link and paste in the browser (prefer to install the version 3.2):
http://python.org/download/
After the installation,do following.
Open a notepad file and type the following code there:
from http.server import HTTPServer, CGIHTTPRequestHandler
port = 8080
httpd = HTTPServer(('', port), CGIHTTPRequestHandler)
print("Starting simple_httpd on port: " + str(httpd.server_port))
httpd.serve_forever()
Save it and remember the location of it.
Thereby,
For Windows user
1.Go to Start -->All Programs-->Python 3.2-->IDLE
2.Press Ctrl+O to open the file saved above.
3.Press F5.
Above window with message "Staring simple_httpd on port 8080" shows success of our work.
For Unix And Mac OS X Users
You need to do two things to prepare your CGI script for execution:
1. Set the executable bit for your CGI using the chmod +x command.
2. Add the following line of code to the very top of your program:
#! /usr/local/bin/python3
Thereby do another thing:
1. Open Terminal (or Shell).
2. Type python <filename of file created above with full path>
That's it,server is running on your *NIX OS.
That's all how a simple "home-made" Python server is made and run,simply with above 4 steps.Send your queries below in the comments.