# Nginx port for socket.io

**URL:** <https://www.ruby-forum.com/t/nginx-port-for-socket-io/238473>\
**Category:** NGINX\
**Created:** [January 13, 2014, 4:19am UTC](https://www.ruby-forum.com/t/nginx-port-for-socket-io/238473 "2014-01-13T04:19:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [January 13, 2014, 4:19am UTC](https://www.ruby-forum.com/t/nginx-port-for-socket-io/238473/1 "2014-01-13T04:19:07Z")

</div>

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:

> **[nginx port for socket.io](https://forum.nginx.org/read.php?2,246293,246293#msg-246293)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![mrblah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a4c791/32.png) [@mrblah](https://www.ruby-forum.com/u/mrblah)\
**Post date:** [January 13, 2014, 5:05am UTC](https://www.ruby-forum.com/t/nginx-port-for-socket-io/238473/2 "2014-01-13T05:05:51Z")

</div>

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]
