-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
71 lines (54 loc) · 1.84 KB
/
nginx.conf
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
60
61
62
63
64
65
66
67
68
69
70
71
events {
#worker_connections 1024;
}
http {
proxy_cache_path /var/run/nginx-cache/jscache levels=1:2 keys_zone=jscache:100m inactive=30d use_temp_path=off max_size=100m;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name stats.alveus.gg;
server_tokens off;
location / {
return 307 https://$host$request_uri;
}
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name stats.alveus.gg;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/stats.alveus.gg/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/stats.alveus.gg/privkey.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
ssl_session_tickets off;
ssl_protocols TLSv1.3 TLSv1.2;
ssl_prefer_server_ciphers off;
# HSTS
#add_header Strict-Transport-Security "max-age=63072000" always;
proxy_buffering on;
proxy_http_version 1.1;
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;
# Cache and proxy script.js
location = /js/script.js {
proxy_pass http://plausible:8000/js/script.js;
proxy_cache jscache;
proxy_cache_valid 200 6h;
proxy_cache_use_stale updating error timeout invalid_header http_500;
add_header X-Cache $upstream_cache_status;
}
location / {
proxy_pass http://plausible:8000/;
# Set CORS headers
if ($http_origin ~* (https?://(localhost:3000|preview.alveus.gg|alveussanctuary.com))) {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
}
}
}
}