valsha
(KingPin)
1
你好,使用 Nginx 提供静态文件是否有意义?
类似如下配置:
location ~ ^/assets/(?<asset_path>.+)$ {
expires 1M;
add_header Cache-Control "max-age=2629746, public";
}
location ~ ^/user_avatar/(?<user_avatar_path>.+)$ {
expires 1M;
add_header Cache-Control "max-age=2629746, public";
}
location ~ ^/uploads/(?<uploads_path>.+)$ {
expires 1M;
add_header Cache-Control "max-age=2629746, public";
}
我们在容器外部使用 Nginx。谢谢。
pfaffman
(Jay Pfaffman)
2
valsha
(KingPin)
3
@pfaffman
我正在尽可能全面地使用您的指南。
除了涉及 nginx 的部分之外。
我的 app.yml 如下:
# - "templates/web.ssl.template.yml"
# - "templates/web.letsencrypt.ssl.template.yml"
# - "80:80" # http
# - "443:443" # https
我可以在生产环境中使用您的 discourse/config/nginx.sample.conf at main · discourse/discourse · GitHub 吗?
谢谢。
1 个赞
pfaffman
(Jay Pfaffman)
4
我认为没有理由让外部 NGINX 直接提供这些文件。虽然技术上可行,但配置复杂、维护困难,且几乎没有任何优势。如果你认为这样做能提升速度,那又何必使用反向代理呢?
valsha
(KingPin)
5
@pfaffman
我之所以这样使用,是因为这台服务器上不仅运行着 Discourse,还有其他网站。