Can I run two web servers on the same computer?

Roman picture Roman · Feb 23, 2010 · Viewed 43.4k times · Source

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?

Answer

user151323 picture user151323 · Feb 23, 2010

Make them listen to different ports and you will be fine.

The default web port is 80. When you open some url in browser without specifying a port, 80 is used by default.

You can configure your web server to listen to a different port but then you will also need to specify it explicitly in the url:

http://localhost:8080

When choosing a port pay attention that this particular port number is not yet in use by any software you have installed and running on your box. Otherwise, as you correctly guessed, there will be a conflict.

P.S. Just a few days ago doing reinstallation I got IIS not able to start (seemingly without reason). Turned out the new version of Skype occupied this default port! Had to remove its setting "Use port 80 and 443 as alternatives for incoming connections".