Very simple and practical Python HTTP service

Source: Internet
Author: User

In the application of distributed systems often in the test environment upload a package, or why, the company's server comparison bug, only to LDAP permissions, each time only SCP to their own personal directory, and then into the public account down CP, more trouble. At this time if you need a simple Web Server, but you do not want to download and install the complex HTTP service programs, such as: Apache,iss. Well, Python might help you. Use Python to complete a simple built-in HTTP server. As a result, you can display your directories and files in HTTP. Just one thing to do is install a python, which is already installed by default on Linux or Mac.

In fact, this is a very useful way to share files. It is simple to implement a tiny HTTP service program, which requires only one command line under Python. For example, if you want to share the TMP directory in the home directory, first CD to the directory, execute the following command:

CD ~/-M simplehttpserver

The default is 8000 port, you can specify the port, open the browser input http://127.0.0.1:8080 can list out the TMP directory all files.

This command usually knocks up for a few seconds and suggests adding to alias.

Vim ~/. Bash_profilealias http='python-m simplehttpserver 20000 ' # Open 20000 port source ~/  ~/tmphttp # Open Service

Open the browser input http://127.0.0.1:20000, the TMP directory files are shared, on the server directly through the wget convenient download your files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.