LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-31-2023, 05:53 AM   #1
Mental-Octopus
Member
 
Registered: Sep 2018
Posts: 51

Rep: Reputation: Disabled
PHP Ratchet Websocket Server With Apache2 Not Working


I have a websocket server written in php, it's the Ratchet websocket server.
I enabled wstunnel for apache. I also added ProxyPass in my website configuration

<VirtualHost *:443>
DocumentRoot /var/www/mywebsite/pav/
ServerName www.mywebsite.com
ServerAlias mywebsite.com

RewriteEngine on
ProxyPass /wss2/ ws://www.mywebsite.com:8080


<Directory /var/www/mywebsite/pav/>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


My website is written php and JS.
In javascript the script I used to connect to the server is


var socket = new WebSocket('wss://www.mywebsite.com:8080');


I checked in my browser (Firefox) using inspect and in the console it says:
Firefox can’t establish a connection to the server at wss://www.xpatvoice.com:8080/.

I've tried other browsers and got the same result.

The thing is I don't know how to tell what's causing it to fail,
I mean any error code or error log to diagnose the problem.

I also tried

var socket = new WebSocket('wss://www.mywebsite.com/wss2/:8080');
 
Old 08-13-2023, 02:59 AM   #2
Mental-Octopus
Member
 
Registered: Sep 2018
Posts: 51

Original Poster
Rep: Reputation: Disabled
Problem was in the site configuration file.
Missed trailing slash after > ProxyPass /wss2/ ws://www.mywebsite.com:8080
it should've been > ProxyPass /wss2/ ws://www.mywebsite.com:8080/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache traffic server on forward mode does not pass websocket shidrang Linux - Server 6 10-04-2021 03:03 AM
Webserver to websocket server connection issue rtlm1 Linux - Networking 1 05-11-2015 02:30 PM
WebSocket over SSH tunnel - is it possible? Vlad.BG Linux - Networking 3 01-18-2015 07:42 AM
LXer: How to configure Varnish for WebSocket traffic LXer Syndicated Linux News 0 04-04-2014 07:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration