-
Notifications
You must be signed in to change notification settings - Fork 17
/
nginx-config
67 lines (51 loc) · 1.73 KB
/
nginx-config
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
server {
server_name www.freemap.sk;
root /home/freemap/www;
location ~ ^/~(.+?)(/.*)?$ {
charset UTF-8;
alias /home/$1/www$2;
autoindex on;
}
location /sitemap {
add_header Content-Type 'text/html';
}
location = / {
set $cond "";
if ($http_user_agent ~ "\b(UCBrowser|PetalBot|YaBrowser|Applebot|Googlebot|AdsBot|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Sogou|ia_archiver|Mediapartners)\b") {
set $cond a;
}
if ($args ~ "layers=X&osm-(node|way|relation)=\d+&lang=sk") {
set $cond "${cond}a";
}
if ($cond = aa) {
rewrite ^ /sitemap/$args;
}
set $lang_sup "en,sk,cs,hu";
set_by_lua_file $lang_accept /etc/nginx/lang.lua $lang_sup;
try_files $uri /index-$lang_accept.html;
}
location ~ /index-\w\w\.html {
add_header Cache-Control 'no-store, max-age=0';
}
location ~ ".+\.[a-z0-9]{20}\..+$|\.png$|\.jpg$" {
add_header Cache-Control 'max-age=31536000';
}
location /pgbadger {
alias /var/www/pgbadger;
}
listen [::]:443 ssl http2; # managed by Certbot
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.freemap.sk/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.freemap.sk/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.freemap.sk) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name www.freemap.sk;
return 404; # managed by Certbot
}