有人可以向我提供 Tornado websocket 聊天演示的 Nginx 配置吗?该演示位于 /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 和 websockets 的更多信息请参见此处.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)