-
Notifications
You must be signed in to change notification settings - Fork 114
/
nginx.conf
65 lines (46 loc) · 1.38 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
map $request_uri $desired_scheme {
default "https";
~elm-package-version=0.1[6-8] "http";
}
server {
if ($scheme != $desired_scheme) { return 301 $desired_scheme://$host$request_uri; }
listen 80;
server_name package.elm-lang.org;
location / {
proxy_pass http://localhost:8019;
}
}
server {
listen 443 ssl;
server_name package.elm-lang.org;
# Package metadata
location ~ /packages/.*/(endpoint|releases)\.json$ {
root /home/prod/package.elm-lang.org;
try_files $uri @fallback;
}
# Web Crawlers
location = /robots.txt {
root /home/prod/package.elm-lang.org;
try_files /robots.txt =500;
}
location = /sitemap.xml {
root /home/prod/package.elm-lang.org;
try_files /sitemap.xml =500;
}
# Static Assets
location /assets/ {
root /home/prod/package.elm-lang.org;
try_files $uri @fallback;
}
# Fallback
location / {
proxy_pass http://localhost:8019;
}
location @fallback {
proxy_pass http://localhost:8019;
}
ssl_certificate /etc/letsencrypt/live/package.elm-lang.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/package.elm-lang.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}