i have a php script which only have some function like get some content or post a file to the server.
now i am trying to open a websocket with JS. But i got everytime that the handshake wouldnt work.
new WebSocket('myDomain.com')
WebSocket connection to 'ws://mydomain.com/ws' failed: Error during WebSocket handshake: Unexpected response code: 200
I am not sure, what is going wrong.
server {
listen 80;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
# listen 80 default_server;
# listen [::]:80 default_server;
# root /var/www/html;
server_name mydomain.com;
# index index.php index.html index.htm index.nginx-debian.html;
listen 443 ssl; # managed by Certbot
# RSA certificate
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}
location / {
try_files $uri $uri/ =404;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
}
}