-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathnginx.conf.example
More file actions
59 lines (50 loc) · 1.66 KB
/
Copy pathnginx.conf.example
File metadata and controls
59 lines (50 loc) · 1.66 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Vulcan nginx configuration — SSL reverse proxy
#
# Usage:
# cp nginx.conf.example nginx.conf
# Edit server_name and ssl_certificate paths below, then:
# docker compose -f docker-compose.prod.yml --profile nginx up -d
#
# For local dev with mkcert:
# brew install mkcert && mkcert -install
# mkdir -p config/nginx/certs
# mkcert -cert-file config/nginx/certs/cert.pem -key-file config/nginx/certs/key.pem vulcan.localhost
upstream vulcan {
server web:3000;
}
# Redirect HTTP to HTTPS
server {
listen 80;
server_name vulcan.localhost;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name vulcan.localhost;
ssl_certificate /etc/nginx/certs/cert.pem;
ssl_certificate_key /etc/nginx/certs/key.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml;
location / {
proxy_pass http://vulcan;
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;
proxy_set_header X-Forwarded-Host $host;
proxy_read_timeout 90;
# WebSocket support (Action Cable)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Cache static assets
location /assets/ {
proxy_pass http://vulcan;
proxy_cache_valid 200 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
}
}