-
-
Notifications
You must be signed in to change notification settings - Fork 331
Expand file tree
/
Copy pathdefault
More file actions
95 lines (71 loc) · 2.86 KB
/
Copy pathdefault
File metadata and controls
95 lines (71 loc) · 2.86 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name daattali.com www.daattali.com;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/daattali.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/daattali.com/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
location /shiny/ {
proxy_pass http://127.0.0.1:3838/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Accept-Encoding ""; # needed for sub_filter to work
# daattali: not sure if the next line is best practice or not, but it works
# redirects /shiny/myapp to /shiny/myapp/
rewrite ^(/shiny/[^/]+)$ $1/ permanent;
sub_filter '</body>' '<div id="more-apps-by-dean" style="position: fixed;right: 0;bottom: 0;padding: 4px;text-align: center;z-index: 99999;background: rgba(0,0,0,0.8);font-size: 14px;color: #fff;"><a href="https://attalitech.com/#portfolio" style="color: #fff;">More apps by Dean</a> • <a href="https://github.com/sponsors/daattali" style="color: hotpink; font-weight: bold;">❤ Support</a></div></body>';
sub_filter_once on;
client_max_body_size 50M;
}
location /rstudio/ {
rewrite ^/rstudio/(.*)$ /$1 break;
proxy_pass http://localhost:8787;
proxy_redirect http://localhost:8787/ $scheme://$host/rstudio/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location ~ /.well-known {
allow all;
}
error_page 500 502 503 504 /5xx.html;
location /5xx.html {
}
error_page 404 /4xx.html;
location /4xx.html {
}
}
server {
if ($host = www.daattali.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = daattali.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name daattali.com www.daattali.com;
return 404; # managed by Certbot
}