-
-
Save Ghostscypher/85f9991f02105d8462cfe647cf569e35 to your computer and use it in GitHub Desktop.
<VirtualHost _default_:443> | |
ServerName example.com | |
ServerAdmin [email protected] | |
DocumentRoot /var/www/public_html/example.com/public | |
<Directory /var/www/public_html/example.com> | |
AllowOverride All | |
</Directory> | |
### Our config starts here ### | |
ProxyPass "/app/" "ws://127.0.0.1:6000/app/" | |
ProxyPass "/apps/" "http://127.0.0.1:6000/apps/" | |
### Our config ends here ### | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
# Add correct paths below for SSL support | |
#SSLEngine on | |
#SSLCertificateFile /path/to/cert.cer | |
#SSLCertificateKeyFile /path/to/cert.key | |
#SSLCertificateChainFile /path/to/fullchain.crt | |
#SSLCACertificateFile /path/to/ca.cer | |
#.... | |
</VirtualHost> |
@Temepest74 they are the routes used by websockets package
Oh, ok. Can you help me solve my problem then? I could not find any helpful documentation online
I run it on port 6001, and let's say that my domain is sub.domain.com
I get this error:
pusher.js:4026 WebSocket connection to 'wss://sub.domain.com/app/dfdfsdfsfddfsdfsdsfsdf?protocol=7&client=js&version=7.0.3&flash=false' failed:
Inside the apache config I have:
<VirtualHost *:443>
ServerAdmin [email protected]
DocumentRoot "/www/wwwroot/sub.domain.com/public/"
ServerName SSL.sub.domain.com
ServerAlias sub.domain.com
#errorDocument 404 /404.html
ErrorLog "/www/wwwlogs/sub.domain.com-error_log"
CustomLog "/www/wwwlogs/sub.domain.com-access_log" combined
#Websocket
ProxyPass "/app/" "ws://sub.domain.com:6001/app/"
ProxyPass "/apps/" "http://sub.domain.com:6001/apps/"
#SSL
SSLEngine On
SSLCertificateFile /www/server/panel/vhost/cert/sub.domain.com/fullchain.pem
SSLCertificateKeyFile /www/server/panel/vhost/cert/sub.domain.com/privkey.pem
#PHP
<FilesMatch \.php$>
SetHandler "proxy:unix:/tmp/php-cgi-81.sock|fcgi://localhost"
</FilesMatch>
#DENY FILES
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
Order allow,deny
Deny from all
</Files>
#PATH
<Directory "/www/wwwroot/sub.domain.com/public/">
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex index.php index.html index.htm default.php default.html default.htm
</Directory>
</VirtualHost>
@Temepest74 I'm assuming the websockets server is running on localhost i.e. 127.0.0.1:6000 then the configuration woiuld be
<VirtualHost *:443>
ServerAdmin [email protected]
DocumentRoot "/www/wwwroot/sub.domain.com/public/"
ServerName SSL.sub.domain.com
ServerAlias sub.domain.com
#errorDocument 404 /404.html
ErrorLog "/www/wwwlogs/sub.domain.com-error_log"
CustomLog "/www/wwwlogs/sub.domain.com-access_log" combined
#Websocket
ProxyPass "/app/" "ws://127.0.0.1:6000/app/" # <--- Change made here
ProxyPass "/apps/" "http://127.0.0.1:6000/apps/" # <--- and here
#SSL
SSLEngine On
SSLCertificateFile /www/server/panel/vhost/cert/sub.domain.com/fullchain.pem
SSLCertificateKeyFile /www/server/panel/vhost/cert/sub.domain.com/privkey.pem
#PHP
<FilesMatch \.php$>
SetHandler "proxy:unix:/tmp/php-cgi-81.sock|fcgi://localhost"
</FilesMatch>
#DENY FILES
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
Order allow,deny
Deny from all
</Files>
#PATH
<Directory "/www/wwwroot/sub.domain.com/public/">
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex index.php index.html index.htm default.php default.html default.htm
</Directory>
</VirtualHost>
This is when you run the websockets using php artisan websocket:serve --host=127.0.0.1 --port=6000
I changed it. I still get the same issue :/.
This is what I found in error.log. I forgot to check it.
ip.1 - - [13/Jan/2022:19:25:36 +0200] "GET /app/code?protocol=7&client=js&version=7.0.3&flash=false HTTP/1.1" 502 411 "-" "X"
ip.2 - - [13/Jan/2022:19:26:07 +0200] "GET /app/code?protocol=7&client=js&version=7.0.3&flash=false HTTP/1.1" 502 411 "-" "X"
@Temepest74 have you by any chance set up SSL on your websockets project i.e. the websockets.conf file if yes remove SSL certificates and restart the websockets server
@Ghostscypher , yes, this was the issue. You have my respect.
Hi, I'm trying to use this same configuration on a Plesk server, as you may know Plesk uses Nginx and Apache, so I'm running the Laravel websockets server without any SSL configuration, but I'm receiving the following error "Status Code: 426 Upgrade header MUST be provided" I'm trying to make a websockets connection from Postman to "wss://website.com/app/ebf..." I know Postman is sending the proper headers but for some reason the websockets server is not receiving all the information? This error is driving me crazy please help.
Hello @monedicolombia I believe your issue is rather from the server and not postman itself, if you'd like further help you can contact me on Gmail via [email protected], i'd be more than happy to help you resolve this issue as for now I can't exactly pinpoint where your configuration issue lies
What do the app and apps stand for?