I want to use Node because it's swift, uses the same language I am using on the client side, and it's non-blocking by definition. But the guy who I hired to write the program for file handling (saving, editing, renaming, downloading, uploading files, etc.), he wants to use apache. So, I must:
Convince him to use Node (he's giving up little ground on that)
Figure out how to upload, download, rename, save, etc. files in node or
I must install apache and node on the same server.
Which is the most favorable situation, and how do I implement that?
With the ProxyPass directive in the Apache httpd.conf
it's not too hard to pipe all requests on a particular URL to your Node.js application:
ProxyPass /node http://localhost:8000
Also, make sure the following lines are not commented out so you get the right proxy and submodule to reroute HTTP requests:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Then run your Node app on port 8000:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Apache!\n');
}).listen(8000, '127.0.0.1');
Then you can access all Node.js logic using the /node/
path on your URL, the rest of the website can be left to Apache to host your existing PHP pages:
Now the only thing left is convincing your hosting company let your run with this configuration!