Websockets. FastCGI or WSGI. SSL. Same domain. How?

空扰寡人 提交于 2019-12-06 11:05:21

Figured it out. Here's my lighttpd config, abbreviated:

# The port of the Socket.IO daemon
var.daemon_port = 9000

ssl.engine = "enable"
ssl.pemfile = "/path/to.pem"

$HTTP["url"] =~ "^/socket.io" {
  proxy.server = ( "" =>
    (("host" => "127.0.0.1", "port" => daemon_port))
  )
}

alias.url = (
  "/favicon.ico" => "/path/to/static/favicon.ico",
  "/robots.txt" => "/path/to/static/robots.txt",
)

fastcgi.server = ( "/app.fcgi" => # Arbitrary path name
  ((
    "bin-path" => "/path/to/app.fcgi",
    "socket" => "/tmp/app-fcgi-" + PID + ".sock",
    "check-local" => "disable",
    "fix-root-scriptname" => "enable",
    "max-procs" => 1,
  ))
)

url.rewrite-once = (
  "^(/socket.io/.*)$" => "$1",
  "^(/(favicon.ico|robots.txt))$" => "$1",
  "^(/.*)$" => "/app.fcgi$1",
)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!