套接字.io -重定向到index.html,而不是.php


Socket.io - Redirects to index.html, not .php

我已经在Laravel上创建了一个非常基本的应用程序&套接字。但是我有一个问题。
在应用程序的根目录中,我有文件app.js -这里是代码:

var app = require('http').createServer(handler);
var io = require('socket.io')(app);
var Redis = require('ioredis');
var redis = new Redis();
app.listen(8000, function() {
    console.log('Server is running!');
});
function handler(req, res) {
    res.writeHead(200);
    res.end('');
}
io.on('connection', function(socket) {
    //
});
redis.psubscribe('*', function(err, count) {
    //
});
redis.on('pmessage', function(subscribed, channel, message) {
    message = JSON.parse(message);
    io.emit(channel + ':' + message.event, message.data);
});

它重定向到公共/目录-好吧,但他不会'看'索引。php仅在索引上。html -当我删除index.html,我有一个空白的页面-哪里是问题?
这里是URL: http://socket.vertisan.usermd.net/

当web服务器中没有配置将index.php作为DefaultIndex来处理时,通常会发生这种情况。要解决这个问题,你应该这样做:

Apache:

在laravel项目的根目录中添加一个新文件,并将其命名为.htaccess。编辑该文件并添加以下内容:

DirectoryIndex index.php

Nginx: 在你的位置块中添加:

location / {
  try_files $uri $uri/index.html;
}

希望它有帮助,如果你正在使用任何其他web服务器让我知道和