VHosts Nginxconfiguration为Playframework Websockets

下面的configuration似乎已经工作,但现在失败了。 我按照这篇文章下载并安装了tcp_proxy_module。

#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/Nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; #server { #} # another virtual host using mix of IP-,name-,and port-based configuration server { listen 80; #listen locahost:8080; server_name localhost.in; location / { proxy_pass http://127.0.0.1:9000; proxy_set_header Host $host; } } }

更新:

Nginx错误日志:

2012/02/21 10:56:59 [error] 14745#0: *278 upstream timed out (60: Operation timed out) while reading upstream,client: 127.0.0.1,server: localhost.in,request: "GET /websocket/room/socket?roomNo=1&user=sameerFF HTTP/1.1",upstream: "http://127.0.0.1:9000/websocket/room/socket?roomNo=1&user=sameerFF",host: "test.localhost.in" 2012/02/21 10:56:59 [error] 14745#0: *257 upstream timed out (60: Operation timed out) while reading upstream,request: "GET /websocket/room/socket?roomNo=1&user=sameerChrome HTTP/1.1",upstream: "http://127.0.0.1:9000/websocket/room/socket?roomNo=1&user=sameerChrome",host: "test.localhost.in" 2012/02/21 10:59:40 [error] 15366#0: *10 upstream timed out (60: Operation timed out) while reading upstream,host: "test.localhost.in"

更新2:

Laravel Homestead:403禁止Nginx

PHP-fpm每天停止很多次

使用Nginx和Etags进行服务器端dynamic内容caching

Nginx反向代理中的SSL传递?

如何configurationNginx的反应路由器HistoryLocation?

有了这个configuration,当我启动Nginx时,我得到一个绑定exception。 如果我删除了tcp设置,Nginx出现了。 对于普通的http请求以及WebSocket请求,我需要将端口80redirect到9000

#user nobody; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/Nginx.pid; events { worker_connections 1024; } tcp { upstream websockets { ## Play! location server 127.0.0.1:9000; } server { listen 80; server_name localhost.in; tcp_nodelay on; proxy_pass websockets; } } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; # another virtual host using mix of IP-,and port-based configuration server { listen 80; #listen locahost:8080; server_name localhost.in; location / { proxy_pass http://127.0.0.1:9000; proxy_set_header Host $host; } } }

Nginx的add_header和caching控件

当使用ExpressjsNginx时502错误的网关

无法用石墨configurationgrafana

502 Elastic Beanstalk上的坏门户Nginx + Puma + rails 3.2

在Docker容器之间共享预编译的资产

它看起来像只是没有工作的网络套接字。 请阅读您再次链接文章 。 你没有修改你的Nginx配置。

根据那篇文章,你的样本配置可能是这样的(尽管我还没有测试过):

tcp { upstream websockets { ## Play! location server 127.0.0.1:9000; } server { listen 80; server_name localhost.in; tcp_nodelay on; proxy_pass websockets; } }

相关文章

本篇内容主要讲解“gitee如何上传代码”,感兴趣的朋友不妨来...
这篇“从gitee上下的代码如何用”文章的知识点大部分人都不太...
这篇文章主要介绍“gitee如何下载仓库里的项目”,在日常操作...
本篇内容主要讲解“怎么在Gitee上更新代码”,感兴趣的朋友不...
本文小编为大家详细介绍“怎么将工程托管到gitee”,内容详细...
这篇文章主要介绍了gitee中图片大小如何调整的相关知识,内容...