Is there a simple and small HTTP static resource server in the Linux operating system? [migrated]

Since the absolute path of HTTP and the absolute path of linux files are essentially different, I want to find a software to act as a temporary HTTP server to assist me in web development.

Suppose the name of this software is server. I hope that when I enter a command, it will start immediately and treat all files in the current directory as static resources.

$ server --port 8080

The port opened by the software is 8080, and there is a demo.txt file in the current directory.

After that, I can ask the file through http://localhost:8080/demo.txt in the browser.

Is there such a linux software package?

I know that nginx can fulfill my test requirements, but for this kind of not particularly complicated function, configuring ningx is not very cost-effective.


Solution 1:

See the post Simple command line HTTP server.

Among the suggested products are SimpleHTTPServer and a whole lot of others in the
Big list of http static server one-liners.

Solution 2:

Since nowadays every Linux distro is shipped with python, you can use it to start a HTTP server that will list and enable you to download the files present in the current directory.

Just run: python3 -m http.server 8080