Working with Web Services.

 


 From today's lesson I'll learn a little bit about the basics on web servers. Admittedly, this is more of an introduction to the basics. But it will allow me to solve today's tasks. Which the academy has prepared to solve.

Well, it's time to get down to reality. Here are two tasks for today that I should undertake:

1. Find a way to start a simple HTTP server inside Pwnbox or your local VM using "npm". Submit the command that starts the web server on port 8080 (use the short argument to specify the port number). 

This question requires a search for information about the simplest web server. Admittedly, it is mainly suitable for hosting files. However, I will present here a little story about it.
 

Unveiling the Mystery of the Simple HTTP Server!
 

Chapter 1: Introduction to Our Hero

In a small, verdant world of code, where HTML, CSS, and JavaScript files coexist harmoniously, there exists a mysterious hero named http-server. But this is no ordinary hero – it's an HTTP server, ready to operate in static mode. Its mission? To serve files as if they were piping hot buns fresh from the oven.
 

Chapter 2: Meeting http-server

On a sunny day, while developers sat at their computers, http-server suddenly appeared. It looked like an ordinary command line, but it held magic within. All it took was typing `http-server -p 8080`, and it sprang to life from the keyboard, ready for action.
 

Chapter 3: Adventures in the Public Directory


http-server had a favorite spot – ./public. There, all the files it wanted to share with the world resided. Everything, from HTML pages to images and style sheets, was ready to be revealed to users.
 

Chapter 4: Open Your Browser!
 

http-serveropened a browser and entered [http://localhost:8080]. Suddenly, the page appeared on the screen! It was magic – HTML files displayed, images were visible, and CSS bestowed style upon them. Even JavaScript worked like a wizard, adding interactivity.
 

Chapter 5: The Secret of Options
 

http-server had its secrets too. It could change ports, listen on different IP addresses, and even serve compressed GZIP files. It was like exploring new worlds!
 

Chapter 6: Conclusion

And so, http-server became a hero who helped developers test their sites, develop projects, and learn. It wasn't a hero from fantasy books, but in the world of code, where every character mattered, it was irreplaceable.

Thus ends our adventure with http-server. Now you too can meet it – just type `http-server -p 8080` and embark on your own little code world conquest!
 

Remember, this is just a tale, and http-server is a tool for serving files. Don't use it in production, but have fun with it in your projects!

2. Find a way to start a simple HTTP server inside Pwnbox or your local VM using "php". Submit the command that starts the web server on the localhost (127.0.0.1) on port 8080. 

Here, too, it took too long to find the answer to this question. Below I will insert a brief description of how to approach and, of course, solve this problem.
 

The command `php -S 127.0.0.1:8080` starts a PHP development server on your local machine. It binds to the IP address `127.0.0.1` (which is the same as `localhost`) and listens on port `8080`. This means you can access your PHP files via a web browser by navigating to `http://127.0.0.1:8080` or `http://localhost:8080`.

Keep in mind that this is a simple development server meant for testing and debugging purposes. It's not suitable for production use. If you're building a more complex web application, consider using a dedicated web server like Apache or Nginx.

Today's tasks have been solved. So I greet you warmly and wish you a good day :D



Comments

Popular posts from this blog

Task Scheduling and System Services: A Theoretical Overview

Three tasks related to user management.