10 Http Server

 

1. Python HTTP Server

Python comes with a built-in HTTP server module.

Python 3:

bash
python3 -m http.server 8080

Python 2:

bash
python -m SimpleHTTPServer 8080

2. Apache HTTP Server

Apache is a widely used web server.

Start Apache:

bash
sudo service apache2 start

3. Nginx

Nginx is another popular web server.

Start Nginx:

bash
sudo service nginx start

4. PHP Built-in Server

PHP has a built-in server for development purposes.

Start PHP Server:

bash
php -S 0.0.0.0:8080

5. Ruby WEBrick

Ruby has a built-in web server called WEBrick.

Start WEBrick:

bash
ruby -run -e httpd . -p 8080

6. BusyBox HTTP Daemon

BusyBox includes a lightweight HTTP server.

Start BusyBox HTTP Daemon:

bash
busybox httpd -f -p 8080

7. Node.js HTTP Server

You can quickly set up a server using Node.js.

Install HTTP-Server:

bash
npm install -g http-server

Start HTTP-Server:

bash
http-server -p 8080

8. SimpleHTTPServer in Perl

Perl can be used to start a simple HTTP server.

Start Perl HTTP Server:

bash
perl -MIO::Socket::INET -e '$|=1; my $s = IO::Socket::INET->new(LocalPort => 8080, Listen => 10, Reuse => 1); while (my $c = $s->accept) { print $c "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\nHello, World!\r\n"; close $c }'

9. SimpleHTTPServer in Bash

Using socat in Bash to start an HTTP server.

Start Bash HTTP Server:

bash
while true; do echo -e "HTTP/1.1 200 OK\r\n$(date)\r\n\r\nHello, World!" | socat TCP-LISTEN:8080,reuseaddr,fork -; done

10. Golang HTTP Server

If you have Go installed, you can use it to start a server.

Golang HTTP Server Code:

go
package main import ( "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello, World!")) } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }

Run the Go Server:

bash
go run server.go

Each of these methods can be used to quickly spin up an HTTP server on Kali Linux for different purposes. Choose the one that best fits your needs.

Next Steps

Would you like to see more advanced configurations for any of these servers, such as enabling HTTPS or serving specific content types?

Comments

Popular posts from this blog

SAMBA SERVER 2.0 #server

Setup SSH for accessing outside from network

Speech tools - espeak and festival etc.