handbook/tools/4.Exploitation/Server/Python-Server-Local.md
2024-08-31 01:07:22 +02:00

1.5 KiB

What is Python Server?

Python Server is a simple HTTP server that allows you to serve static content from a local directory. It is part of the Python standard library and can be used as a lightweight alternative to more complex web servers such as Apache or Nginx.

With Python Server, you can quickly create a local web server to serve HTML, CSS, and JavaScript files or other static assets. It is particularly useful for web developers who need to test their web applications locally before deploying them to a production server.

Common Use and Commands

To start a Python Server, you need to navigate to the directory containing the files you want to serve and run the following command:

python -m http.server <PORT_NUMBER>

where PORT_NUMBER is the port number on which you want to run the server (e.g., 8000). Once the server is running, you can access your files by opening a web browser and navigating to http://localhost:<PORT_NUMBER>.

Python Server also provides some additional options, such as specifying the IP address to bind to, restricting access to certain directories, or enabling directory listings. You can find more information about these options in the official documentation.

More Information

If you want to learn more about Python Server or contribute to its development, you can check out the official Python documentation at https://docs.python.org/3/library/http.server.html.