-
Notifications
You must be signed in to change notification settings - Fork 0
/
oscarator.com.conf
77 lines (64 loc) · 1.94 KB
/
oscarator.com.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
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name oscarator.com;
# deny requests with invalid host header
if ( $host !~* ^(oscarator.com)$ ) {return 444;}
# SSL
ssl_certificate /etc/letsencrypt/live/oscarator.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/oscarator.com/privkey.pem;
# security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# . files
location ~ /\.(?!well-known) {
deny all;
}
# logging
access_log /var/log/nginx/oscarator.com.access.log;
error_log /var/log/nginx/oscarator.com.error.log warn;
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/oscarator.sock;
uwsgi_param Host $host;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
}
# Django static
location /static/ {
alias /opt/apps/oscarator/static/;
}
# favicon.ico
location = /favicon.ico {
log_not_found off;
access_log off;
}
# robots.txt
location = /robots.txt {
log_not_found off;
access_log off;
}
# gzip
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
}
server {
listen 80;
listen [::]:80;
server_name oscarator.com;
# ACME-challenge
location ^~ /.well-known/acme-challenge/ {
root /var/www/_letsencrypt;
}
location / {
return 301 https://oscarator.com$request_uri;
}
}