只有websocket和xhr使用socket.io和nginx代理传递

我有一个问题,可能会或可能不会有关nginx代理传递。

socket.io在端口7022上,但nginxpipe理端口80上的所有请求。对于socket.io来说非常好用,而且对xhr至less有一半好处。 我从来没有得到flashsocket或html文件的工作。 也许不是杰森普。

我说这可能与nginx中的代理有关,因为在socket.io代理替代变得在nginx中可用之前的几个月,我确实删除了flashsocket。

我经常在论坛上看到socket.io只是起作用。 “我从来没有改变任何东西在服务器上”“你不应该需要太… socket.io这一切都为你…只是把它保持原样。

我的交通工具到了

io.set('transports', ['websocket','xhr-polling','jsonp-polling']); 

而下面是推荐的:

  io.set('transports', [ 'websocket' ,'flashsocket' ,'htmlfile' ,'xhr-polling' ,'jsonp-polling' ]); 

这是我的nginx代理configuration

  location /socket.io { proxy_pass http://localhost:7022; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; } 

我的nginx服务器也服务于一些静态HTML以及与FastCGI服务器监听127.0.0.1:9000

额外的nginx设置

 server { listen 80; #server blah blah client_max_body_size 100M; client_body_buffer_size 5M; location / { try_files $uri $uri/ @rewrites; # This block will catch static file requests, such as images, css, js location ~* \.(?:ico|css|gif|jpe?g|png)$ { # Some basic cache-control for static files to be sent to the browser expires max; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { fastcgi_buffer_size 2M; fastcgi_intercept_errors off; fastcgi_buffers 4 2M; fastcgi_read_timeout 200; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; } # this prevents hidden files (beginning with a period) from being served location ~ /\. { deny all; } # opt-in to the future add_header "X-UA-Compatible" "IE=Edge,chrome=1"; 

任何明显的? 任何人与运输问题与socket.io? 也许与nginx路由结合?