Вот моя конфигурация:
У меня Apache 2.4 и последняя strong>PHP Ratchet (2.4.4)
Скрипт My Chat (из официального руководства Ratchet) прекрасно работает на локальном хосте (с использованием < em>telnet)
Но как только я использую его из веб-браузера, он не работает: «Соединение WebSocket с 'wss://ws.my_site.fr/wss2» /' не удалось: "
Я прочитал здесь, что мне нужно использовать прокси. Я думал, что сделал все правильно, поэтому не знаю, в чем дело:
Мой файл конфигурации (/etc/apache2/sites-enabled/002-my_site-ssl.conf):< /p>
Код: Выделить всё
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ProxyPass /wss2/ ws://ws.my_site.fr:8080/
ServerName my_site.fr
Код: Выделить всё
var conn = new WebSocket('wss://ws.my_site.fr/wss2/');
conn.onopen = function(e) {
console.log("Connection established!");
};
conn.onmessage = function(e) {
console.log(e.data);
};
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/79103446/ratchet-php-with-ssl-apaches-proxy-isnt-working[/url]