相关疑难解决方法(0)

nginx作为webserver包含.socket.io和node.js/ws:// 400 Bad Request

我有这个错误请求.

FireBug的错误

德语中的最后一句是指"Firefox无法连接到位于ws:// ......."的服务器.

服务器不会是我认为的问题.

因为这里是nginx配置,因为我觉得有问题!

server {
    server_name example.org;
    listen 80 default_server;
    root /var/www/web;

    location / # for symfony2
    {
        try_files $uri @rewriteapp;
    }

    location @rewriteapp # for symfony2
    {
                rewrite ^(.*)$ /app.php/$1 last;
    }

    location ~ ^/app\.php(/|$)
    {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param HTTPS off;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ ^/socket
    {
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
    }

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
}
Run Code Online (Sandbox Code Playgroud)

nginx版本:nginx/1.4.7

app.js(那就是服务器!)

var …
Run Code Online (Sandbox Code Playgroud)

sockets web-services nginx node.js socket.io

10
推荐指数
1
解决办法
5967
查看次数

标签 统计

nginx ×1

node.js ×1

socket.io ×1

sockets ×1

web-services ×1