Docker, NGINX, Shiny-Server, SSL - Page rendering issue

September 21, 2019 @Landon

@Landon wrote:

Hi everyone,

I'm currently working in a docker environment leveraging to bring SHINY to life.

Docker, and docker-compose.
Nginx:latest
rocker/shiny-verse
certbot/certbot

When I run Nginx as a reverse proxy to Shiny, it works just fine. I see the default welcome screen with the working apps on the right hand side.

When I implement my certbot image, configuration files, and SSL keys, I see the same welcome screen, but only text renders. See screenshot.

Here is my docker-compose.yml file:

version: '3'

services:
  nginx:
    image: nginx
    container_name: webserver
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
  shiny:
    image: rocker/shiny-verse
    container_name: shiny
    restart: unless-stopped
    expose:
      - 3838

  certbot:
    image: certbot/certbot
    container_name: cert
    volumes:
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"

Here is my Nginx.conf file:

events { }

http {

  map $http_upgrade $connection_upgrade {
      default upgrade;
      ''      close;
    }

  server {
    listen 80;
    server_name <my.domain.here.com>;
    return 301 https://<my.domain.here.com>$request_uri;
         }

   server {
    listen 443 ssl;
    server_name <my.domain.here.com>;
    ssl_certificate /etc/letsencrypt/live/<my.domain.here.com>/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/<my.domain.here.com>/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    access_log /var/log/nginx/data-access.log combined;

    location / {
       proxy_pass http://shiny:3838/;
       proxy_set_header X-Real-IP  $remote_addr;
       proxy_set_header X-Forwarded-For $remote_addr;
       proxy_set_header Host $host;

       proxy_redirect http://shiny:3838/ $scheme://$http_host/;
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection $connection_upgrade;
       proxy_read_timeout 20d;
       proxy_buffering off;
       }
   }
}

Really, any pointers, suggestions is greatly appreciated. Been trying for a couple days combing through everything before I jumped on for help.

Thanks!

Posts: 3

Participants: 1

Read full topic

Previous Article
Kubernate websocket (R/Shiny) load balancer frequent timeout
Kubernate websocket (R/Shiny) load balancer frequent timeout

@yanglian1 wrote: Issue description No any issue when only one pod created. If t...

Next Article
Unable to make JDBC connection when running as rstudio-connect user
Unable to make JDBC connection when running as rstudio-connect user

@jeff.keller wrote: This is a weird one... I have a shiny app that calls out to ...