apache和nodejs代理

use*_*857 6 apache proxy node.js

我希望nodejs与apache一起工作.

我尝试编辑apache的httpd,就像这样

 <VirtualHost *:80>
   ServerAdmin info@admin.bb
    ServerName www.myserver.net

    ProxyRequests off

   <Proxy *>
        Order deny,allow
        Allow from all
  </Proxy>

  <Location />
        ProxyPass http://localhost:8000/
        ProxyPassReverse http://localhost:8000/
   </Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

我在很多博客中都看到了上述方法,而且在SO中也是如此.我救了,我重新启动了apache而且我得到了

502 Proxy Error
Proxy Error

The proxy server received an invalid response from an upstream server.
 The proxy server could not handle the request GET /mysite/index.php.

Reason: Error reading from remote server
Run Code Online (Sandbox Code Playgroud)

这种方法有什么问题?

请原谅我的无知,我不知道如何解决这个问题.

这是节点服务器的一部分,我设置了一个服务器......

"use strict";
var WebSocketServer = require('websocket').server;
var http = require('http');
var pg = require('pg');


var server = http.createServer(function(request, response) {
    console.log((new Date()) + ' Received request for ' + request.url);
    response.writeHead(200, {'Content-Type': 'text/html'});
    response.end(clientHtml);
});
server.listen(8000, function() {
    console.log((new Date()) + ' Server is listening on port 8000');
});

var wsServer = new WebSocketServer({
    httpServer: server,
    autoAcceptConnections: false
});

function originIsAllowed(origin) {
  return true;
}
//FALLBACKING FOR WEBSOCKETS
var pf = require('policyfile').createServer();
pf.listen( server, function(){
  console.log(':3 yay')
});
//STOPS HERE

wsServer.on('request', function(request) {
    if (!originIsAllowed(request.origin)) {
      request.reject(); 
      console.log((new Date()) + ' Connection from origin ' + request.origin + ' rejected.');
      return;
    }

//////////////


//prepare things to distinguish connections
var connections = {};
var connectionIDCounter = 0;
var connection = request.accept(null, request.origin);

// Store a reference to the connection using an incrementing ID
connection.id = connectionIDCounter ++;
connections[connection.id] = connection;

console.log((new Date()) + ' Connection accepted.');
Run Code Online (Sandbox Code Playgroud)

Sto*_*ica 0

/mysite/index.php

您要求 NodeJS 提供 PHP 页面。它不会那样做。