nginx port for socket.io

Andy Tynefield atynefield at gmail.com
Mon Jan 13 04:05:20 UTC 2014


The nginx configuration provided is valid for this use case. Ensure that the browser is attempting to connect to the domain on port 80 for the socket io stuff and ensure that socket io is listening on the same port along with the node app.

[Sent from Andrew's iPhone]

> On Jan 12, 2014, at 9:18 PM, "mrblah" <nginx-forum at nginx.us> wrote:
> 
> I have a node application that uses websockets. I'm using a custom config
> file like this. However, when I post to the application, the post isn't
> appearing in the client side of the application.  Since it's using
> websockets to communicate between client and server, i'm wondering if I have
> a problem with the port numbers. You can see in my config that the server is
> listening on 80, but the proxy_pass is set to localhost:3000.  Should these
> numbers be the same? if so can I set Nginx to listen on 3000?
> 
> /etc/nginx/conf.d/domainame.com.conf
> 
> server {
>    listen 80;
> 
>    server_name your-domain.com;
> 
>    location / {
>        proxy_pass http://localhost:3000;
>        proxy_http_version 1.1;
>        proxy_set_header Upgrade $http_upgrade;
>        proxy_set_header Connection 'upgrade';
>        proxy_set_header Host $host;
>        proxy_cache_bypass $http_upgrade;
>    }
> }
> 
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,246293,246293#msg-246293
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list