问题描述
我正在将socket.io和laravel echo服务器与Redis一起使用,并且还在服务器上安装了SSL,但是socket.io文件未加载到生产ubuntu服务器上,我在本地窗口中一切正常,我不确定生产需要其他配置,我也允许UFW 6001端口。
这是我的laravel-echo-server.json文件。
{
"authHost": "https://flowerful.initialengine.com","authEndpoint": "/broadcasting/auth","clients": [
{
"appId": "bb6e18dd7fd2e7aa","key": "c52b04fae249d3cb303b317b281b1599"
}
],"rejectUnauthorized": false,"database": "redis","databaseConfig": {
"redis": {},"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},"devMode": true,"host": null,"port": "3001","protocol": "https","socketio": {},"secureOptions": 67108864,"sslCertPath": "/etc/letsencrypt/live/flowerful.initialengine.com/fullchain.pem","sslKeyPath": "/etc/letsencrypt/live/flowerful.initialengine.com/privkey.pem","sslCertChainPath": "","sslPassphrase": "","subscribers": {
"http": true,"redis": true
},"apiOriginAllow": {
"allowCors": true,"allowOrigin": "https://flowerful.initialengine.com","allowMethods": "GET,POST","allowHeaders": "Origin,Content-Type,X-Auth-Token,X-Requested-With,Accept,Authorization,X-CSRF-TOKEN,X-Socket-Id"
}
}
我在不同的门户网站上搜索并获得帮助,并在下面应用了一些内容。
我脑海中可能正在发生某些事情。 我安装的虚拟主机可能是apache2,不允许域在6001端口上运行
URL不起作用。
https://flowerful.initialengine.com:6001/socket.io/?EIO=3&transport=polling&t=NLFfgwB
解决方法
就我而言,仅关闭了端口 6001。 检查服务器是否在您的端口上提供项目服务:
curl -I localhost:your_port_here
如果您收到 http 标头,则表示一切没问题,您只需要打开端口即可。
对于开放端口:
iptables -I INPUT -p tcp --dport 6001 --syn -j ACCEPT
service iptables save
,
我认为您应该为.cert
配置生成并设置带有laravel-echo-server
和'.key'扩展名的正确SSL文件,如下所示:
"sslCertPath": "/{path_of_ssl}/flowerful.initialengine.com.cert.combined","sslKeyPath": "/{path_of_ssl}/flowerful.initialengine.com.key",