ApacheサブディレクトリをNode.jsアプリケーションにリダイレクトしたいと思っています。 http://example.com/subdirname
を通じて自分のサイトに接続しようとすると、今私はsocket.io
ために404エラーを取得し、しかしApacheサブディレクトリをNode.jsにリダイレクトするときにsocket.ioにアクセスする
<VirtualHost *:80>
# Already existing Apache lines here removed to keep this post short
# The following are all the new lines I have added
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
<Location /mysubdir>
ProxyPass http://127.0.0.1:3000
ProxyPassReverse http://127.0.0.1:3000
</Location>
</VirtualHost>
:私は私の通常のドメインのための私のApacheのVirtualHostの.confファイルに次のように追加されました。私app.jsで
私は次のように持っていた:
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io')(server, {path: '/mysubdir/socket.io'}).listen(server);
しかし、それはまだ私に404エラーを与える:別のstackoverflowポストに基づいて
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);
私はこれに私のapp.jsを変更。私は間違って何をしていますか?
更新:私は以下の回答を投稿してくれました。私は数分間それをテストしましたので、あなたが道を離れて問題を起こすようなことに気付いた場合は、それを見て気軽に見てください。