这个问题可能超出了WPSE的范围。但我的解决方案是在Nginx后面的不同端口上安装PHP-FPM并运行Node和PHP-FPM。
Nginx配置示例(需要调整)
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;
}