In that case you need to add a little to your Apache setup to help in this process.
Prepare Apache
In your /etc/apache2/apache2.conf file:Make sure these 2 lines are uncommented (or even exist)
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Now add the following (it can be at the end if you like)
ProxyPass /mynodesite http://localhost:8000
Restart Apache
systemctl reload apache2Create the application file
Create a file in /var/www/html/mynodesite called app.js and insert the following:var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World!\n');
}).listen(8000, '127.0.0.1');
Run the app
node app.jsNow the browser
Open the browser with the address http://localhost/mynodesiteHey presto!
No comments:
Post a Comment