<p>Has anyone had any success running two different web servers -- such as Apache and CherryPy -- alongside each other on the same machine?  I am experimenting with other web servers right now, and I'd like to see if I can do my experiments while keeping my other sites up and running.  You could say that this isn't so much a specific-software question as it is a general networking question.</p>

<ul>
<li>I know it's possible to run two web servers on different ports; but is there any way to configure them so that they can run on the <em>same port</em> (ie, they both run on port 80)?</li>
<li>The web servers would <em>not</em> be serving files from the same domains.  For example, Apache might serve up documents from foo.domain.com, and the other web server would serve from bar.domain.com.</li>
</ul>

<p>I do know that this is not an ideal configuration. I'd just like to see if it can be done before I go sprinting down the rabbit hole.  :)  </p>

[{'answer_id': 23718, 'author': 'Ishmaeel', 'author_id': 227, 'author_profile': 'https://Stackoverflow.com/users/227', 'pm_score': 0, 'selected': False, 'text': '<p>Your best bet would be putting Apache httpd in front of port 80 and relay requests meant for other servers through Apache by using modules. Most popular scenario would be Tomcat behind Apache where you\'ll be able to run both php and jsp applications.</p>\n\n<p>I\'m not familiar with CherryPy, so I can only suggest you look for an Apache module for CherryPy.</p>\n\n<p>Edit: This looks promising: <a href="http://tools.cherrypy.org/wiki/BehindApache" rel="nofollow noreferrer">http://tools.cherrypy.org/wiki/BehindApache</a></p>\n'}, {'answer_id': 23723, 'author': 'Dana the Sane', 'author_id': 2567, 'author_profile': 'https://Stackoverflow.com/users/2567', 'pm_score': 0, 'selected': False, 'text': "<p>Alternatively, to Ishmaeel's correct answer, if you have a server with 2 network cards, you could have each server answer requests on different IP addresses.</p>\n"}, {'answer_id': 23732, 'author': 'Gary Richardson', 'author_id': 2506, 'author_profile': 'https://Stackoverflow.com/users/2506', 'pm_score': 4, 'selected': True, 'text': '<p>You can\'t have two processes bound to the same port on the same IP address. You can add another IP address to the box and have each server listen on one.</p>\n\n<p>Another option is to proxy pass one server to the other. With Apache, you could do something like:</p>\n\n<pre><code>NameVirtualHost *\n&lt;virtualhost *&gt;\n  ServerName other.site.com\n\n  # assumes CherryPy listens on port 8080\n  ProxyPass / http://127.0.0.1:8080/\n  ProxyPassReverse / http://127.0.0.1:8080/\n&lt;/Virtualhost&gt;\n</code></pre>\n\n<p>That\'s a pretty quick example, but you can always check the <a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html" rel="noreferrer">ProxyPass documentation</a>. Remember though, the application being proxyed to will get 127.0.0.1 in it\'s logs instead of the requester\'s IP address. Some web servers (apache does with <a href="http://stderr.net/apache/rpaf/" rel="noreferrer">mod_rpaf</a>) can substitute the X-Forwarded-For header in place of the wrong IP address. Possibly CherryPy has this?</p>\n'}]
['https://Stackoverflow.com/questions/23715', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2321/']