Debian 9, Nginx, SSL, PHPwebsocket Problem

0

I have mounted a server with debian 9, nginx and SSL certificates let's encrypt. To this server I have migrated a project that had websocket assets and everything works except the websocket that fails to perform the handshake. With the following error code:

  

WebSocket connection to 'wss: // ****** / wss2' failed: Error during WebSocket handshake: Unexpected response code: 200

The websocket used is: link

and my nginx directives are:

server {
        listen *:80;

        listen *:443 ssl;
                ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_certificate /var/www/clients/client0/web1/ssl/******.bewor.com-le.crt;
        ssl_certificate_key /var/www/clients/client0/web1/ssl/******-le.key;

        server_name ****** www.******;

        root   /var/www/******/web/;



        index index.html index.htm index.php index.cgi index.pl index.xhtml;


        location ~ \.shtml$ {
            ssi on;
        }


        error_page 400 /error/400.html;
        error_page 401 /error/401.html;
        error_page 403 /error/403.html;
        error_page 404 /error/404.html;
        error_page 405 /error/405.html;
        error_page 500 /error/500.html;
        error_page 502 /error/502.html;
        error_page 503 /error/503.html;
        recursive_error_pages on;
        location = /error/400.html {

            internal;
        }
        location = /error/401.html {

            internal;
        }
        location = /error/403.html {

            internal;
        }
        location = /error/404.html {

            internal;
        }
        location = /error/405.html {

            internal;
        }
        location = /error/500.html {

            internal;
        }
        location = /error/502.html {

            internal;
        }
        location = /error/503.html {

            internal;
        }

        error_log /var/log/ispconfig/httpd/******/error.log;
        access_log /var/log/ispconfig/httpd/******/access.log combined;

        location ~ /\. {
                        deny all;
        }

        location ^~ /.well-known/acme-challenge/ {
                        access_log off;
                        log_not_found off;
                        root /usr/local/ispconfig/interface/acme/;
                        autoindex off;
                        index index.html;
                        try_files $uri $uri/ =404;
        }

        location = /favicon.ico {
            log_not_found off;
            access_log off;
            expires max;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        }

        location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
        }

        location /stats/ {

            index index.html index.php;
            auth_basic "Members Only";
            auth_basic_user_file /var/www/clients/client0/web1/web//stats/.htpasswd_stats;
        }

        location ^~ /awstats-icon {
            alias /usr/share/awstats/icon;
        }
        location ~ \.php$ {
            try_files /8c034b151a08b4a94debf4820ebcb4c8.htm @php;
        }

        location @php {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            fastcgi_pass unix:/var/lib/php7.0-fpm/web1.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_intercept_errors on;
        }

        location /cgi-bin/ {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            root /var/www/clients/client0/web1;
            gzip off;
            fastcgi_pass  unix:/var/run/fcgiwrap.socket;
            fastcgi_index index.cgi;
            fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_intercept_errors on;
        }
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        location / {
                try_files $uri $uri/ /index.php;
        }

        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
                        expires           15d;
        }

        location /wss2 {
            proxy_pass https://******/ws2/server.php;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_read_timeout 86400;
            proxy_cache_bypass 1;
            proxy_no_cache 1;
        }



}

I have already tried a thousand things and I do not know where the error can come from. Any suggestions?

When I run the server.php file with php -q server.php I get the following error:

  

PHP Warning: socket_bind (): unable to bind address [99]: Can not assign address address in /var/www/clients/client0/web1/web/ws2/class.PHPWebSocket.php on line 112

    
asked by Korzan 06.06.2018 в 18:40
source

0 answers