我有這個錯誤要求。德語的最后一句意思是“ Firefox無法連接到位于ws:// .......的服務(wù)器”。服務(wù)器不會是我認(rèn)為的問題。因為這是nginx配置,因為我認(rèn)為存在問題!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;}nginx版本:nginx / 1.4.7app.js(即服務(wù)器?。﹙ar express = require('express'), io = require('socket.io').listen(server), server = require('http').createServer(app), bodyParser = require('body-parser');var app = express();server.listen(8080);app.use(bodyParser.json());app.post('/', function(request, response){ response.send('OK'); io.emit('MessageForAll', request.body);});io.on('connection', function (socket){});console.log('Server running on port 8080.');
3 回答

倚天杖
TA貢獻(xiàn)1828條經(jīng)驗 獲得超3個贊
是否可以像我上面所說的那樣嘗試在本地服務(wù)器上設(shè)置新實例,或者將位置^?/ socket放在ngnix配置中的位置上方/下方或位置下方的頂部。我確定它的發(fā)生僅是由于ngnix配置。我嘗試使用除symfony2設(shè)置以外的相同目錄。我也在用package.json更新答案。請檢查一下。
- 3 回答
- 0 關(guān)注
- 1037 瀏覽
添加回答
舉報
0/150
提交
取消