-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathnginx.example.conf
More file actions
38 lines (33 loc) · 1.1 KB
/
Copy pathnginx.example.conf
File metadata and controls
38 lines (33 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Example nginx config for docker-compose.example.yml. Serves the app's
# storage directly (avoiding the app process itself), proxies everything
# else through to the app service.
#
# This config doesn't handle HTTPS, that should be done by your actual
# reverse proxy.
#
# Paths must match src/main.rs's actix_files mounts:
# /static -> static
# /storage -> storage/public
server {
listen 80;
location /static/ {
alias /app/static/;
}
location /storage/ {
alias /app/storage/public/;
autoindex off;
# content-addressed files safe to cache forever
# since the hash is the filename
location ~ "^/storage/(.*/[a-f0-9]{2}/[a-f0-9]{64}(?:\.[a-z0-9]+)?)/?$" {
alias /app/storage/public/$1;
add_header Cache-Control "public, max-age=31536000, immutable";
}
}
location / {
proxy_pass http://app:3000;
proxy_set_header Host $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 $scheme;
}
}