[英]Laravel-echo-server , net::ERR_CONNECTION_TIMED_OUT
I have a strange problem only on live server using laravel-echo-server , redis , ssl . 我只有在使用laravel-echo-server , redis , ssl的实时服务器上才遇到一个奇怪的问题。
Error: GET https://dev.my_domain.com:6001/socket.io/?EIO=3&transport=polling&t=Ml1g-Fq net::ERR_CONNECTION_TIMED_OUT
错误:
GET https://dev.my_domain.com:6001/socket.io/?EIO=3&transport=polling&t=Ml1g-Fq net::ERR_CONNECTION_TIMED_OUT
Below you can find my configs: laravel-echo-server.json 在下面您可以找到我的配置:laravel-echo-server.json
{
"authHost": "https://dev.my_domain.com",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {
"port": "6379",
"host": "127.0.0.1"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "https",
"socketio": {},
"sslCertPath": "/etc/letsencrypt/live/dev.my_domain.com/fullchain.pem",
"sslKeyPath": "/etc/letsencrypt/live/dev.my_domain.com/privkey.pem"
}
Bootstrap.js Bootstrap.js
import Echo from 'laravel-echo';
window.io = require('socket.io-client');
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001'
});
Port 6001 is enabled: tcp6 0 0 :::6001 :::* LISTEN 10728/laravel-echo-
端口6001已启用:
tcp6 0 0 :::6001 :::* LISTEN 10728/laravel-echo-
After running laravel-echo-server start 运行laravel-echo-server后启动
L A R A V E L E C H O S E R V E R
version 1.5.5
⚠ Starting server in DEV mode...
✔ Running at localhost on port 6001
✔ Channels are ready.
✔ Listening for http events...
✔ Listening for redis events...
Server ready!
It is working correctly on my localhost without ssl configuration. 没有ssl配置,它可以在我的本地主机上正常工作。
Let me know if someone has a solution for this problem , 让我知道是否有人可以解决此问题,
Thanks to everyone in advance 预先感谢大家
I found a solution to my problem . 我找到了解决问题的办法。
below configs seems ok now :), 现在下面的配置似乎还可以:),
First you need to update apache2 configs : Enable modules: 首先,您需要更新apache2 configs:启用模块:
a2enmod proxy_wstunnel
Update apache Config Location : /etc/apache2/sites-available/**your_domain_config**.conf
更新apache配置位置:/
/etc/apache2/sites-available/**your_domain_config**.conf
Added here: 在这里添加:
SSLEngine on
SSLProxyEngine On
ProxyRequests Off
ProxyPass /socket.io http://dev.DOMAIN.com:6001/socket.io
ProxyPassReverse /socket.io http://dev.DOMAIN.com:6001/socket.io
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://dev.DOMAIN.com:6001%{REQUEST_URI} [P]
Restart Apache: 重新启动Apache:
systemctl restart apache2
My laravel-echo-server-json : 我的laravel-echo-server-json:
{
"authHost": "https://dev.DOMAIN.com",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {
"port": "6379",
"host": "127.0.0.1"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "https",
"socketio": {},
"sslCertPath": "/etc/letsencrypt/live/DOMAIN/fullchain.pem",
"sslKeyPath": "/etc/letsencrypt/live/DOMAIN/privkey.pem"
}
Update Bootstrap.js : 更新Bootstrap.js:
import Echo from 'laravel-echo';
window.io = require('socket.io-client');
window.Echo = new Echo({
broadcaster: 'socket.io',
host: { path: '/socket.io' }
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.