Binding to multiple ports
Closed this issue · 6 comments
It would be nice if CouchDB could be served bind to multiple ports. Is that doable? See also:
That person is incorrect. There's no such limitation. mochiweb has no global configuration, each server is configured independently and you can run arbitrarily many of them on a given erlang node.
@etrepum Have to think about this. What you are saying is you can run 2 servers if you want to bind on 80 and 5984. Alexander seems to be saying there is only 1 server that can't bind to 2 ports.
In zotonic we run multiple mochiweb instances, each on their own port, to handle SSL traffic.
There is indeed no limitation in mochiweb, just start multiple servers, each on their own port.
I didn't think about nodejs-way to handle this problem, but about some acceptor that can bind on IP-port pair and work with a single web server instance.
mochiweb doesn't even have the concept of a "web server instance", the "web server instance" is your Erlang node. mochiweb_http processes are the acceptors that spawn off workers to run the given loop function per connection. If you start more than one mochiweb_http process on the same node with the same loop function but on different ports this is indistinguishable from having a "web server instance" that is listening on more than one port.