Python’s SimpleHTTPServer is a module that allows you to instantly create a web server or serve your files in a snap. With SimpleHTTPServer, you don’t need to install anything since you have python interpreter installed. It is very simple to install Python server on CentOS 7 and this article sheds light on it.
You can install Python by executing the yum command in your terminal.
[root@linuxhelp Desktop]# yum install python -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirror.vbctv.in * extras: mirror.vbctv.in * updates: mirror.vbctv.in . . . Updated: python.x86_64 0:2.7.5-48.el7 Dependency Updated: python-libs.x86_64 0:2.7.5-48.el7 Complete!
Once it is done, start python http server by running the following command.
[root@linuxhelp Desktop]# python2.7 -m SimpleHTTPServer 8880 Serving HTTP on 0.0.0.0 port 8880 ...
After that, open your browser and give the url as serverip:8880(192.168.7.165:8880). It will display the server. The sever starts running on your screen.
While server runs in browser, you can see the it will log details displayed on your terminal.
[root@linuxhelp Desktop]# python2.7 -m SimpleHTTPServer 8880 Serving HTTP on 0.0.0.0 port 8880 ... 192.168.7.165 - - [03/Aug/2017 06:16:53] "GET / HTTP/1.1" 200 - 192.168.7.165 - - [03/Aug/2017 06:16:53] code , message File 192.168.7.165 - - [03/Aug/2017 06:16:53] "GET /favicon.ico HTTP/1.1" - 192.168.7.165 - - [03/Aug/2017 06:16:53], message File
With this, the installation of Phython Server is complete.
Thank you! for using Linux Help.
You find this tutorial helpful? Share with your friends to keep it alive.
For more help topics browse our website www.linuxhelp.com
Be the first to comment, we value your suggestions. For further queries please comment below.