Skip to content

Instantly share code, notes, and snippets.

@magic-lantern
Last active Oct 26, 2018
Embed
What would you like to do?
Nginx Configuration for HTTPS RStudio Server reverse proxy
##
# Customized Nginx configuration
##
server {
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name rstudio.learnclinicaldatascience.org; # managed by Certbot
access_log /var/log/nginx/rstudio.learnclinicaldatascience.org;
location / {
proxy_set_header Host $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_http_version 1.1;
# have to add http_upgrade lines to /etc/nginx/nginx.conf for these next 2 lines to work
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 7d;
# Fix the “It appears that your reverse proxy set up is broken" error.
proxy_pass http://localhost:8787;
proxy_redirect http://localhost:8787 $scheme://$http_host/;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/rstudio.learnclinicaldatascience.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/rstudio.learnclinicaldatascience.org/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
}
server {
if ($host = rstudio.learnclinicaldatascience.org) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name rstudio.learnclinicaldatascience.org;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment