mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: cache avatars in NGINX
This commit is contained in:
parent
1d717088c3
commit
cea5350a3c
@ -10,6 +10,8 @@ upstream discourse {
|
|||||||
server unix:/var/www/discourse/tmp/sockets/thin.3.sock;
|
server unix:/var/www/discourse/tmp/sockets/thin.3.sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proxy_cache_path /var/nginx/cache keys_zone=one:10m max_size=200m;
|
||||||
|
|
||||||
# If you are going to use Puma, use these:
|
# If you are going to use Puma, use these:
|
||||||
#
|
#
|
||||||
# upstream discourse {
|
# upstream discourse {
|
||||||
@ -112,10 +114,7 @@ server {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
# This big block is needed so we can selectively enable
|
location ~ ^/backups/ {
|
||||||
# acceleration for backups and avatars
|
|
||||||
# see note about repetition above
|
|
||||||
location ~ ^/(backups|letter_avatar|user_avatar) {
|
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
@ -126,6 +125,22 @@ server {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# This big block is needed so we can selectively enable
|
||||||
|
# acceleration for backups and avatars
|
||||||
|
# see note about repetition above
|
||||||
|
location ~ ^/(letter_avatar|user_avatar) {
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $thescheme;
|
||||||
|
# note x-accel-redirect can not be used with proxy_cache
|
||||||
|
proxy_cache one;
|
||||||
|
proxy_cache_valid any 1m;
|
||||||
|
proxy_cache_valid 200 301 302 7d;
|
||||||
|
proxy_pass http://discourse;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
# this means every file in public is tried first
|
# this means every file in public is tried first
|
||||||
try_files $uri @discourse;
|
try_files $uri @discourse;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user