Alex Rivera | Logout

Can I run two web servers on the same computer?

Asked 2010-02-23T16:10:40.153
27

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 machine. But I am afraid that I can get some kind of conflict if I try it. I mean how two web server will "decide" who needs to server a request from a client?

Edit
Report

1 Answer

8

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/

answered 2010-02-23T16:14:26.380

Your Answer