Simple Webserver

From PCLinuxOSHelp Knowledge Base
Jump to: navigation, search

Simple webserver[edit]

Running a Simple Web server on PCLinuxOS[edit]

1. Open a console and change Directory that you want you Simple Server to run from.
2. Now enter the command to start your Simple Server
 python -m SimpleHTTPServer

If you wish to change the port that's used start the program via:

 $ python -m SimpleHTTPServer 8080

or a port number you wish to use.


Example: I named my Directory SimpleServer. In a console window, I started it using the following.

 [dwmoar@prototype Pictures]$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...

Now opening your favorite web browser enter the following URL

http://localhost:80000

You should see your index.html file. If you do not have a index.html file in the directory you will see a listing of all the files in the directory.


with a index.html file

Simplerserver-index.png


No index.html file present
Simpleserver-noindex.png


It will even work from a public IP


Simple Server does NOT replace Apache or other servers such as lighttpd. It doesn't support php, but it is a quick way to test out your html, without setting up a bigger resource hungry web server.


And there you go. Happy web serving!