0

can i run multiple python http servers on one machine to receive http post request from a webpage?

currently i am running an http server on port 80 and on the web page there is a HTML form which sends the http post request to the python server and in the HTML form i am using the my server's address like this : "http://123.123.123.123" and i am receiving the requests

but i want to run multiple servers on the same machine with different ports for each server.

if i run 2 more servers on port 21200 and 21300 how do i send the post request from the HTML form on a specified port , so that the post request is received and processed by correct server??

do i need to define the server address like this : "http://123.123.123.123:21200" and "http://123.123.123.123:21300" ?

Arad016
  • 53
  • 8
  • 4
    Does this answer your question? [Can I run two web servers on the same computer?](https://stackoverflow.com/questions/2319697/can-i-run-two-web-servers-on-the-same-computer) – Eric Qvarnström Jun 20 '20 at 19:25

1 Answers1

4

Yes can run multiple webservers on one machine.

use following commands to run on different ports:

python3 -m http.server 4000

4000 is the port number, you can replace it with any port number here.

Suraj Gupta
  • 437
  • 8
  • 19