server { listen 80 default_server; listen [::]:80 default_server; server_name davidjhindley.com www.davidjhindley.com; if ($host = davidjhindley.com) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = www.davidjhindley.com) { return 301 https://$host$request_uri; } # managed by Certbot return 404; # managed by Certbot } server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; server_name davidjhindley.com www.davidjhindley.com; ssl_certificate /etc/letsencrypt/live/davidjhindley.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/davidjhindley.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 root /var/www/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } 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 "upgrade"; rewrite ^(/shiny/[^/]+)$ $1/ permanent; } location /rstudio/ { proxy_pass http://127.0.0.1:8787/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }