I have written a Node JS server waiting to sit on a server. In an ideal world, I'd like to create a sub-domain which points to the Node server. I have seen articles that allow you to v-host Apache to proxy forward to the node server on a specific port / port.
Example:
<VirtualHost 109.74.199.47:80>
ServerAdmin [email protected]
ServerName thatextramile.be
ServerAlias www.thatextramile.be
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/
</Location>
http://thatextramile.be/blog/2012/01/hosting-a-node-js-site-through-apache/
People are suggesting however, that this isn't the best method as Apache's process will block until node has responded. Also it seems to be problematic with ajax requests.
Is there another way to point a sum-domain to Node JS without using Apache? Would it cause a problem if Node sits on port x and Apache on ports 80 and 443? Would they ever conflict?
Apache's process will block until node has responded. Two things - first, this is completely wrong for proxied connections because at the networking level Apache uses non-blocking I/O just like node.js. Second, even if this was Apache instead of Apache2 (ie. old Apache) it doesn't matter since Apache is multi-threaded. A blocked process (thread really) will simply make Apache spawn a new process (actually thread but on Linux they're the same thing anyway) to service new connections.