Start Simple HTTP Server with Python
This methode wil install the webserver in The same directory where you apply the python command.
The command will read automaticly the index.html page . if there is no index.html will list the contents of the directory .
So lets start
[root@test11 html]# ls
[root@test11 html]# touch index.html
[root@test11 html]# view index.html
(make your Welcome text message)
[root@test11 html]# python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 …
Test11.unixmen.com – - [23/Sep/2009 07:00:29] “GET / HTTP/1.1″ 200 –
Now open your browser with
http://localhost:8000 or http://127.0.0.1 or http://IP:8000
Other way you can change the web port with :
python -m SimpleHTTPServer 8081 or other port
If you want to make your server local in your intern LAN of Only on this server edit this Pyhton script :
from SimpleHTTPServer import SimpleHTTPRequestHandler
HandlerClass = SimpleHTTPRequestHandler
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"
port = int(sys.argv)
port = 8000
server_address = ('127.0.0.1', port)
HandlerClass.protocol_version = Protocol
httpd = ServerClass(server_address, HandlerClass)
sa = httpd.socket.getsockname()
print "Serving HTTP on", sa, "port", sa, "..."
Like us on Facebook
We need your assistance to stay live
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- News from Kaspersky Lab: Tor is protecting criminals : In a previous article I wrote a bit about Tor. Free browser, relays bouncing your IP all over the ...1 comment |
- Grive: An Unofficial, Open Source Linux Client For Google Drive : A couple of months before, we have featured a Linux client for Google Drive named Syncdrive, which w...2 comments |
- How To Access A LVM Drive / Partition in Ubuntu : Hey Guys, I installed Fedora on an external drive (LVM) recently and was trying to access it from U...0 comments |
- Adding and Deleting Cluster Resources (corosync pacemaker) : In our previous tutorial, we have shown you how to install corosync and pacemaker. We will show y...0 comments |
- Install Satis On Ubuntu Sever 13.10/13.04 : Satis is a simple static composer repository generator. It is used in any composer.json file as i...0 comments |
- Adding and Deleting Cluster Resources (corosync pacemaker)
- News from Kaspersky Lab: Tor is protecting criminals
- Install Satis On Ubuntu Sever 13.10/13.04
- How To Access A LVM Drive / Partition in Ubuntu
- How To Disable Remember Open Files in Sublime Text 3
- Install Sublime Text 3 In Fedora Easily With Fedy
- Grive: An Unofficial, Open Source Linux Client For Google Drive
- Install nSnake Game In Terminal
- How To “Fix E: Could not open file /var/lib/dpkg/status”
- Wow! Linux Foundation To Offer Free Linux Course This Summer Worth $2,400 on EdX
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .