-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmpweb.net.conf
67 lines (55 loc) · 1.52 KB
/
tmpweb.net.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
##
# tmpweb.net static serving and proxying
##
server {
# Redirect HTTP to HTTPS.
listen [::]:80;
listen 80;
server_name tmpweb.net www.tmpweb.net;
if ($host = tmpweb.net) {
return 308 https://tmpweb.net$request_uri;
}
if ($host = www.tmpweb.net) {
return 308 https://tmpweb.net$request_uri;
}
# If no Host match, close the connection to prevent host spoofing.
return 404;
}
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name tmpweb.net www.tmpweb.net;
# TLS certificates managed by Certbot.
ssl_certificate /etc/letsencrypt/live/tmpweb.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tmpweb.net/privkey.pem;
# Allow uploading reasonably large archives.
client_max_body_size 100M;
# Use naked domain.
if ($host = www.tmpweb.net) {
return 308 https://tmpweb.net$request_uri;
}
# Path for static files.
root /var/www/tmpweb/html;
index index.html index.htm;
# Custom error pages.
error_page 403 404 /404.html;
error_page 500 502 503 504 /500.html;
# Remove .html extension from served files.
if ($request_uri ~ ^/(.*)\.html$) {
return 301 /$1$is_args$args;
}
location /ping {
proxy_pass http://127.0.0.1:8000;
}
location / {
# Send POST requests to application server.
if ($request_method = POST) {
proxy_pass http://127.0.0.1:8000;
}
# Checks for static file, if not found return a 404 error.
try_files $uri $uri.html $uri.htm $uri/ =404;
# Generate index page listing files if there isn't one provided.
autoindex on;
autoindex_exact_size off;
}
}