哦,所以文件应该是默认的——通常是 index.html?
确实有效!组件期望 URL 指向一个 index 文件,对吧?
我只需将我的 home.html 重命名为 index.html,并将 Nginx 配置更改为:
# 更多配置...
root /srv/www/zoethical.org/thx;
index index.html; # <- 这很重要
location = /TransHack_·Xist·nce… {
default_type text/html;
alias /srv/www/zoethical.org/thx/index.html; # <- 并且需匹配
}
location / {
# nginx 魔法:在代理之前尝试本地文件...
try_files $uri $uri/ $uri.html @discourse;
}
location @discourse {
# 正常的 Discourse 代理
}
总结一下…
如果你在 Discourse 实例所在的同一个站点上使用静态页面,请确保你的 Web 服务器在将请求代理到 Discourse 之前先读取静态文件(例如相关的 CSS)。搞定!
感谢 @pfaffman!