Skip to content

Commit de82bdc

Browse files
committed
docker: fix nginx configuration to serve correctly avatar links
1 parent a743883 commit de82bdc

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

INSTALL.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,24 @@ server {
176176
177177
listen 0.0.0.0:80;
178178
179-
location ~ ^/(avatars|medias)/ {
179+
location ~ ^/medias/ {
180180
root /home/linuxfr/linuxfr.org/uploads;
181181
}
182182
183-
# To install the LinuxFr img service, see: https://github.com/linuxfrorg/img-LinuxFr.org
183+
# Avatars files uploaded on linuxfr server are stored in partitions
184+
# with folder name containing 3 digits
185+
location ~ ^/avatars/\d\d\d/ {
186+
root /home/linuxfr/linuxfr.org/uploads;
187+
}
188+
189+
# Avatars URLs has to be served by the image service
190+
location ~ ^/avatars/ {
191+
# To install the LinuxFr img service, see: https://github.com/linuxfrorg/img-LinuxFr.org
192+
proxy_pass http://localhost:8000;
193+
}
194+
184195
location /img/ {
196+
# To install the LinuxFr img service, see: https://github.com/linuxfrorg/img-LinuxFr.org
185197
proxy_pass http://localhost:8000;
186198
}
187199

deployment/nginx/templates/image.dlfp.conf.template

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ server {
44

55
server_name ${IMAGE_DOMAIN};
66

7-
location ~ ^/(avatars|medias)/ {
7+
location ~ ^/medias/ {
88
root /var/linuxfr/uploads;
99
}
1010

11+
# Avatars files uploaded on linuxfr server are stored in partitions
12+
# with folder name containing 3 digits
13+
location ~ ^/avatars/\d\d\d/ {
14+
root /var/linuxfr/uploads;
15+
}
16+
17+
# All other images (avatars URLs and /img) pass by the image service
1118
location / {
1219
proxy_pass http://linuxfr-img:8000;
1320
}

0 commit comments

Comments
 (0)