【问题标题】:Nginx configuration for the Tornado websocket demo?Tornado websocket 演示的 Nginx 配置?
【发布时间】:2014-04-17 12:20:04
【问题描述】:

有人可以为我提供 Tornado websocket 聊天演示的 Nginx 配置吗?该演示位于 /tornado/demos/websocket...

【问题讨论】:

    标签: nginx websocket chat tornado demo


    【解决方案1】:

    这样的配置会起作用:

    events {
        worker_connections  1024;
    }
    
    http {
        upstream chatserver {
            server 127.0.0.1:8888;
        }
    
        server {
            # Requires root access.
            listen       80;
    
            # WebSocket.
            location /chatsocket {
                proxy_pass http://chatserver;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
            }
    
            location / {
                proxy_pass http://chatserver;
            }
        }
    }
    

    您需要以 root 身份运行 Nginx 以侦听端口 80。现在您可以使用浏览器访问“localhost”。 More info on Nginx and websockets here.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-28
      • 2023-03-18
      • 2014-05-29
      • 1970-01-01
      • 2020-01-25
      • 1970-01-01
      • 2020-01-23
      • 1970-01-01
      相关资源
      最近更新 更多