Accessing socket.io server via Apache served pages

前端 未结 2 1856
甜味超标
甜味超标 2021-01-17 18:14

I hope this doesn\'t come across as a terribly silly question, but I\'m learning how to implement a socket.io server for my website to produce real-time applications, but my

2条回答
  •  悲哀的现实
    2021-01-17 18:25

    Generally, you should be able to hide Node.js with mod_proxy. A bit of searching turned up this: https://github.com/sindresorhus/guides/blob/master/run-node-server-alongside-apache.md (old link died, this is a new one)

    However, Socket.io can be a bit finicky (https://github.com/LearnBoost/socket.io/issues/25), so you may have problems with it specifically.

    As that ticket is a bit old, it's worth a shot. Just don't be surprised if you have problems. You're next bet after that is bind Node.js toport 80 and have it act as a reverse proxy for Apache with https://github.com/nodejitsu/node-http-proxy (still under a fair bit of development).

    The optimal solution would be run it on it's own server and just have you're socket traffic go to socket.example.com or something like that.

提交回复
热议问题