forked from synackray/flask-password
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
61 lines (49 loc) · 1.56 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
server {
server_name www.example.com;
root /home/user/sites/example.com/www;
access_log /home/user/sites/logs/example.com.access.log;
error_log /home/user/sites/logs/example.com.error.log;
location /pass {
return 301 /flask-password/;
}
location /flask-password {
try_files $uri @flask_pass;
}
location /flask-password/(css|font-awesome|js) {
try_files $uri $uri/ =404;
}
location @flask_pass {
proxy_set_header Host $http_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;
proxy_pass http://unix:/home/user/sites/example.com/www/flask-password/flask-password.sock;
}
location ~ /\. {
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
deny all;
}
location ~* \.py$ {
# Deny all attempts to access Python scripts.
deny all;
}
# SSL configuration has been omitted from this configuration.
# Consider using Let's Encrypt.
}
server {
server_name example.com;
listen 443 ssl; # managed by Certbot
return 301 https://www.$host$request_uri;
# SSL configuration has been omitted from this configuration.
# Consider using Let's Encrypt.
}
server {
server_name example.com;
listen 80;
return 301 https://www.$host$request_uri;
}
server {
server_name www.example.com
listen 80;
return 301 https://$host$request_uri;
}