This question is probably beyond the scope of WPSE. But my solution would be to install PHP-FPM and run Node and PHP-FPM on different ports behind Nginx.
Sample Nginx Config (will require tweaking)
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:3000; // Assuming Node is running on port 3000
proxy_redirect off;
}
location /blog {
rewrite /blog/?(.*) /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:9000; // Assuming PHP-FPM is running on port 9000
proxy_redirect off;
}