Tutorials and other answers doesn't help. I know that thing is in nginx config, but where?
I have CentOS 6.5, nginx 1.4.4, node 0.10.24, socket.io.js 0.9.16 and
in my_server_nginx.conf, node section:
location ~ /node {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
in app.js:
var io = require('/usr/lib/node_modules/socket.io/lib/socket.io').listen(3000);
in html:
<script type="text/javascript" src="/node/socket.io/socket.io.js"></script>
in browser console:
Uncaught ReferenceError: io is not defined
Direct open /node/socket.io/socket.io.js
returns
Welcome to socket.io.
In this case, '/node/socket.io/socket.io.js' is your socket root directory. and the socket.io js file will be served from within there. try linking to '/node/socket.io/socket.io.js/socket.io.js'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.