Lighttpd 和 Discourse(Docker):配置 mod_proxy

Lighttpd 和 Discourse(Docker):配置 mod_proxy

我在配置 Lighttpd 来为我服务器上托管的各种服务提供服务时遇到了麻烦。Lighttpd 充当前端,我有几个 DNS 记录,每个记录对应一个不同的子域,重定向到同一台机器。

目标是通过主机将这些请求分发到其他各个 Web 服务器。

具体来说,Discourse 被设置为一个 Docker 容器。内嵌的 Nginx 监听80容器的端口,并3080通过 Docker 映射到服务器的端口:

$ docker ps
CONTAINER ID        IMAGE                          COMMAND                CREATED             STATUS              PORTS                                                                                                                              NAMES
7b115219788e        local_discourse/app:latest     "/sbin/runit"          11 weeks ago        Up 8 weeks          0.0.0.0:3022->22/tcp, 0.0.0.0:3080->80/tcp 

mod_proxy在 Lighttpd 上启用了它,配置如下:

server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
        "mod_rewrite",
        "mod_proxy",
)

server.document-root        = "/var/www"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80


index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

$HTTP["host"] =~ "discourse.mydomain.com" {
    proxy.debug = 1
    proxy.server  = ( "" => ( "discourse" => ( "host" => "127.0.0.1", "port" => 3080, "fix-redirects" => 1 )))
}

我可以说电话正在某处,因为日志告诉我:

2014-11-17 21:15:55: (mod_proxy.c.1144) proxy - start
2014-11-17 21:15:55: (mod_proxy.c.1185) proxy - ext found
2014-11-17 21:15:55: (mod_proxy.c.1319) proxy - found a host 127.0.0.1 3080
2014-11-17 21:15:55: (mod_proxy.c.398) connect delayed: 10
2014-11-17 21:15:55: (mod_proxy.c.1000) proxy: fdevent-out 1
2014-11-17 21:15:55: (mod_proxy.c.1029) proxy - connect - delayed success
2014-11-17 21:15:55: (mod_proxy.c.969) proxy: fdevent-in 4
2014-11-17 21:15:55: (mod_proxy.c.667) proxy - have to read: 521
2014-11-17 21:15:55: (mod_proxy.c.969) proxy: fdevent-in 4
2014-11-17 21:15:55: (mod_proxy.c.667) proxy - have to read: 0

然而,当我访问时,我看到的discourse.redacted.com只是一个空白页 - 请注意,而不是 404 错误。

我是否遗漏了一些显而易见的东西?

还有其他我可以提取的日志吗?

额外信息:呼叫discourse.redacted.com:3080有效并能让我到达那里。

答案1

您是否尝试过这个:

proxy.server  = ("/" =>  (( "host" => "127.0.0.1", "port" => 3080, "fix-redirects" => 1 )))

相关内容