-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
77 lines (64 loc) · 1.57 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
72
73
74
75
76
77
upstream owntrackbackend {
server 127.0.0.1:{{owntracks_port}};
}
server {
if ($host = {{owntracks_domain_name}}) {
return 301 https://$host$request_uri;
}
listen 80;
server_name {{owntracks_domain_name}};
return 404;
}
server {
##
# Basic Settings
#
listen 443 ssl;
server_name {{owntracks_domain_name}};
root /var/www/html/{{owntracks_domain_name}};
index index.html;
charset utf-8;
expires $expires;
add_header Strict-Transport-Security max-age=15768000;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
##
# SSL Settings
##
ssl_certificate /etc/letsencrypt/live/{{owntracks_domain_name}}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{owntracks_domain_name}}/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
##
# Path & Error Settings
##
location / {
auth_basic "Who are you?";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://owntrackbackend;
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;
}
error_page 404 /404.html;
location /404.html {
internal;
}
##
# Logging Settings
##
access_log /var/log/nginx/{{owntracks_domain_name}}_access.log;
error_log /var/log/nginx/{{owntracks_domain_name}}_error.log;
location /robots.txt {
access_log off;
}
location ~ /favicon.png {
access_log off;
}
##
# Gzip Settings
##
gzip on;
gzip_types text/plain application/json;
}