I was able to set up an Apache web server on my home computer, running on Port 80. My forward pathing has been set up so that my public domain takes me to my Apache HTDOCs files. The point, to clarify, is that I was able to host my own web server, so I can host my own website. I am successfully able to show HTML content.
Now, I would like to add NodeJS to this feature, and I am somewhat confused as to how.
Following the answer on this link, I made sure to uncomment the following lines on my httpd
file:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Now I am a little confused on where, in my httpd
file, to put this line:
ProxyPass /node http://localhost:8000/
For that matter, I am unsure if this will allow me to access my nodejs externally.
Also, I wonder if I am supposed to be installing NodeJS on my Apache folder, in my case c:/Apache24
. If so, what directory would I install that in?
To add, my test node file (named nod.js) contains the following code.
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Apache!\n');
}).listen(8000);
I run this via node nod
on my htdocs. While this works in localhost, it does not display on my external ip.
EDIT: From this example I believe that I have to wrap my ProxyPass inside Virtual Host, something like so:
<VirtualHost *:80>
ProxyPass /node http://localhost:8000/ connectiontimeout=5 timeout=30 # optional timeout settings
</VirtualHost>
This doesn't work, though I assume its within the ballpark of what I'm supposed to be doing.