用于Tornado Websocket演示的Nginx配置吗? [英] Nginx configuration for the Tornado websocket demo?
本文介绍了用于Tornado Websocket演示的Nginx配置吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以向我提供有关Tornado Websocket聊天演示的Nginx配置吗?该演示位于/tornado/demos/websocket ...
Can someone please provide me with Nginx configuration for the Tornado websocket chat demo? the demo is located under /tornado/demos/websocket...
推荐答案
这样的配置将起作用:
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". 有关Nginx和网络套接字的更多信息,请点击此处.
You'll need to run Nginx as root in order to listen on port 80. Now you can visit "localhost" with your browser. More info on Nginx and websockets here.
这篇关于用于Tornado Websocket演示的Nginx配置吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文