I have a two part question
Question 1
Is it wrong to use Apache as a proxy to my nodeJS server as it cannot handle Websockets. I am using Apache with BOSH presently and I would like to know what is the right way to deploy with node so that I can use websockets too.
My apache configurations are as follows
ServerName example.com
ProxyPass / http://localhost:9000/
ProxyPassReverse / http//localhost:9000/
Order allow,deny
Allow from all
Is this approach completely wrong? I am able to use my app (which works as an API ) without trouble. I would need to add websocket support soon and would this configuration fail then?
Question 2
I would also like to know how can I get NodeJS to write the logs to a file.
1) It is wrong to use something like Apache to proxy Node.js, it's better to use something like Nginx or Node solutions like node-proxy or bouncy. It's wrong because Apache is blocking and creates a new thread per connection, totally different from Nginx and Node. By using Apache you'll remove the advantages Node.js provides you (thousands concurrent connections and low memory footprint).
2) As far as I know, probably the most 'popular' logging library is Winston.
With new version of Apache (2.4.5+), you may use mod_proxy_wstunnel to achieve this.
I recently did a simple experiment. It appears to work fine with the combination of Apache, Nodejs and socket.io.
Details: https://github.com/mksamfolk/sandbox/tree/master/apache_websocket
Well actually the mad scientists made node-http-proxy to make sure people don't use Apache or Nginx as a proxy for NodeJS. If you ask me I would say use the module, much easier and lighter and faster(not so sure, but it node!).
As of logging I would recommend using Winston module which is pretty easy to use.