以下の設定は動作したようですが、今は失敗しています。私はこのarticleに続いて、tcp_proxy_moduleをダウンロードしてインストールしました。VHosts Playframework WebsocketのためのNginxの設定
#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のエラーログ:私は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, client: 127.0.0.1, server: localhost.in, 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, 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"
は2を更新しました。 tcp設定を削除すると、nginxが正常に起動します。私はそれが動作していないだけでWebSocketをだように見えます両方の通常のHTTP要求のために9000にリダイレクトするだけでなく、のWebSocketは
#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-, 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やログファイルにエラーメッセージがありますか(エラーログを再度有効にした後はもちろんです:))それは機能していないWebsocketsの部分だけですか? – Carsten
私はチャットの例のエラーログエントリを追加しました。それらはTimeOutExceptionsのように見えます。 –