gpt4 book ai didi

Laravel-echo-server , net::ERR_CONNECTION_TIMED_OUT

转载 作者:可可西里 更新时间:2023-11-01 11:23:24 32 4
gpt4 key购买 nike

我只在使用 laravel-echo-serverredisssl 的实时服务器上遇到一个奇怪的问题。

错误:获取 https://dev.my_domain.com:6001/socket.io/?EIO=3&transport=polling&t=Ml1g-Fq net::ERR_CONNECTION_TIMED_OUT

下面你可以找到我的配置: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

import Echo from 'laravel-echo';

window.io = require('socket.io-client');

window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001'
});

端口 6001 已启用:tcp6 0 0:::6001:::* LISTEN 10728/laravel-echo-

运行 laravel-echo-server start 之后

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!

它在没有 ssl 配置的情况下在我的本地主机上正常工作。

如果有人解决了这个问题,请告诉我,

提前感谢大家

最佳答案

我找到了解决问题的方法。

下面的配置现在看起来没问题:),

首先你需要更新 apache2 配置:启用模块:

a2enmod proxy_wstunnel

更新apache配置位置:/etc/apache2/sites-available/**your_domain_config**.conf

在此处添加:

    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]

重新启动 Apache:

systemctl restart apache2

我的 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"
}

更新 Bootstrap.js :

import Echo from 'laravel-echo';

window.io = require('socket.io-client');

window.Echo = new Echo({
broadcaster: 'socket.io',
host: { path: '/socket.io' }
});

关于Laravel-echo-server , net::ERR_CONNECTION_TIMED_OUT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56901401/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com