Can I run two web servers on the same computer?

后端 未结 7 994
执笔经年
执笔经年 2020-12-23 22:12

I just found out that I can write a really simple web server using Python. I have already an Apache web server I would like to try the Python based web server on this machi

7条回答
  •  天涯浪人
    2020-12-23 22:27

    A web server is tied to a specific port. Normally, this is port 80. If the port is not explicitly specified, this is the port that a browser will attempt to hit.

    You can get your alternate server to run on a different port ( 8080 or 8081 seem to be popular alts for web servers, but the choice is yours ).

    This'll stop the conflict from happening. Everything going to port 80 hits your old server. Everything going to 8080 ( or whatever port you decide to run your server on ) will hit your simple python server.

    To hit your other server, use a URL like :-

    http://localhost:8080/

提交回复
热议问题