valsha
(KingPin)
22. August 2021 um 09:21
1
Hi, Does it make sense to serve static files using nginx?
Something like:
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";
}
We are use nginx outside the container. Thank you.
pfaffman
(Jay Pfaffman)
22. August 2021 um 13:15
2
valsha
(KingPin)
22. August 2021 um 13:34
3
@pfaffman
I am using your guide to almost the fullest extent.
Except for the part concerning nginx
my app.yml
# - "templates/web.ssl.template.yml"
# - "templates/web.letsencrypt.ssl.template.yml"
# - "80:80" # http
# - "443:443" # https
Can i use your discourse/nginx.sample.conf at main · discourse/discourse · GitHub in production?
Thanks.
1 „Gefällt mir“
pfaffman
(Jay Pfaffman)
23. August 2021 um 13:35
4
I don’t think that there is any reaon to have the external NGINX serve those files directly. I think that you can, but it’ll be hard to configure, hard to maintain, and provide virtually no benefit. If you thought that it would make things faster, why would you use a reverse proxy at all?
valsha
(KingPin)
23. August 2021 um 14:45
5
@pfaffman
I am using it this way because there are other sites running on this server, not just discourse.