This comprehensive Linux guide expects that you run the following commands as root user but if you decide to run the commands as a different user then ensure that the user has
sudoaccess and that you precede each of the privileged commands withsudo
HTTP is the abbreviation of “HyperText Transfer Protocol”. A protocol is like a language with a simple grammar. The HTTP Server is the implementation of that protocol in a piece of Software.
The HTTP Server “serves” content located in the server, this includes HTML, images, flash and any file related. The server is not restricted to server static content, it also serves dynamic content generated on fly from a database or similar.
This tutorial will guide you about how to serve files or folders from one computer to another over local area network (LAN) using Web Browsers over HTTP.
Using Python Web Server (SimpleHTTPServer)
Python is pre-installed in almost every distribution of UNIX/LINUX system. We can use python to create a web server to serve files or folders over HTTP.
For Python 2.7
If you are using the python 2.7.x, you can use the following command:
root@codesposts:~$ python -m SimpleHTTPServer 8080Replace the 8080 with your desired port number.
For Python 3
If you are using python 3.x, you can use the following command:
root@codesposts:~$ python -m http.server 8080Replace the 8080 with your desired port number.
If you don’t specify the port number, the default port it 8000.
Testing Web Server
Open your browser and go to 127.0.0.1:8080 You will see the home page of your web server.
Using Busybox Web Server
Busybox is also called the Swiss Army knife of Embedded Linux. It is preinstalled on Debian Based Distributions.
Installing Busybox
If busybox is not preinstalled on your system, you can install it by running the following command:
root@codesposts:~$ apt-get install busyboxStarting A New Server
To start a new server using busybox on your system, you can run the command like below:
root@codesposts:~$ busybox httpd -p 127.0.0.1:8080 -h /var/www/Replace 8080 with your desired port number.
Stopping The Server
To stop a running server, run the command like this:
root@codesposts:~$ pkill busyboxUsing Webfsd Web Server
This is one of the most lightweight web servers in linux. It is highly configurable and the configurations are stored in /etc/webfsd.conf file which can be edited easily. 
Installing Webfsd
Run the following command to install the webfsd server on your system
root@codesposts:~$ apt-get install webfsStarting The Web Server
Run the following command to start a web server:
root@codesposts:~$ service webfs startUsing netcat Command To Start A Web Server
You can also start a web server using the netcat command on a local host that will open a static web page “sample.html”. To perform this, you can run the command like this
First, make a new file with the name “sample.html” and copy the following code into the file.
<html>
        <head>
                <title>Test Page</title>
        </head>
        <body>
                <h1>Level 1 header</h1>
                <h2>Subheading</h2>
                <p>Normal text here</p>
        </body>
</html>Then run the following command:
root@codesposts:~$ while true; do nc -lp 80 < sample.html; doneAfter this, you can access the page on by going to “http://server-IP.com/sample.html”
Using php Web Server
You can easily start a web server on your system if you have installed php 5.4 or above. To do that, you can run the following command on your terminal:
root@codesposts:~$ php -S 127.0.0.1:8080Replace “8080” with your desired port number.
Using Ruby Web Server
We can also use Ruby to serve files over HTTP. 
You can use the instructions below to start a server using ruby on your system.
root@codesposts:~$ ruby -run -ehttpd . -p8080
[2019-08-16 14:03:43] INFO WEBrick 1.4.2
[2019-08-16 14:03:43] INFO ruby 2.5.1 (2018-03-29) [x86_64-linux]
[2019-08-16 14:03:43] INFO WEBrick::HTTPServer#start: pid=5859 port=8080You can now access the contents of this folder from any remote system using URL: http://your-IP:8080/
You can also change the Port number according to your desire.
Using NodeJS (Http-server)
If you don’t have NodeJS already installed on your system, you can see How to install NodeJS
Installing http-server
After the installation of NodeJS, run the following command to install the http-server
root@codesposts:~$ npm install -g http-serverServing Files On Web Server
Now, go to the directory whose contents you want to share over HTTP, and run the following command
root@codesposts:~$ http-server -p 8080
Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8080
  http://192.168.150.14:8080
  http://192.168.150.10:8080
Hit CTRL-C to stop the serverYou can change the port number according to your desire.

 
					 
								 
								 
								 
								 
								 
								