Issue in configuring nginx for libwebsocket

Hemant Kumar mailtohemantkumar at gmail.com
Sat Oct 19 02:09:37 UTC 2013


Hi All

I am a newbie with nginx server. I am trying to get websocket configuration
working on cent-os.(linux 2.6.32-358.18.1.el6.x86_64). Following is my
nginx config file;

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local]
"$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
           * proxy_pass http://localhost:80*;
            proxy_http_version 1.1;
            *proxy_set_header Upgrade $http_upgrade;*
*            proxy_set_header Connection "upgrade";*
*            proxy_set_header Host $host;*
            proxy_read_timeout 3600;
            proxy_send_timeout 3600;
        }

        #error_page  404              /404.html;
         location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}


With above configuration, and with proxy_pass set, it gices 502 error. When
I try to access
ws://127.0.0.1:80 using chrome websocket client.

I will highly appreciate if someone can give right pointer to resolving
this.

Thanks a ton

Hemant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20131018/563535d3/attachment.html>


More information about the nginx mailing list