If you are new to Unixmen, you may want to subscribe : ![]()
![]()
![]()
![]()
|
23 September 2009
So lets start
cd /var/www/html
[root@test11 html]# ls
info.php
[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 :
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
HandlerClass = SimpleHTTPRequestHandler
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"
if sys.argv[1:]:
port = int(sys.argv[1])
else:
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[0], "port", sa[1], "..."
httpd.serve_forever()
Enjoy


http://localhost:8000 or http://127.0.0.1 or http://IP:8000 are all local, yes? how do i enable the http server to be accessible by the public?