Nginx Ssl config, Shinyproxy port forwarding


#1

I have a working app running on http, similar to the given example : https://github.com/openanalytics/shinyproxy-config-examples/tree/master/02-containerized-docker-engine

The only thing different is when launching the app i’m using another port 10029 to forward to 8080 to have access to the link (command). I do not have the access to the port 8080:

docker run -d -v /var/run/docker.sock:/var/run/docker.sock --net sp-example-net -p 10029:8080 shinyproxy-example

The link is now accessible http://hostname.com:10029

Now i’m trying to setup Ssl certificate so I can run my webapp on https. I’m using the config file from https://www.shinyproxy.io/security/#https-ssl-tls. I tried to replace the port 8080 with 10029 but no results (still showing link only on http)

I’ve already setup nginx and added certificates to corresponding path, using this tutorial https://www.youtube.com/watch?v=X3Pr5VATOyA
Here my /etc/nginx/conf.d/hostname.conf:

server {
listen 80;
server_name hostname.com;
rewrite ^(.*) https://$server_name$1 permanent;
}

server {
listen 443 ssl;
server_name hostname.com;
access_log /var/log/nginx/shinyproxy.access.log;
error_log /var/log/nginx/shinyproxy.error.log error;

#ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

ssl_certificate /etc/nginx/ssl/hostname.com.crt;
ssl_certificate_key /etc/nginx/ssl/hostname.com.key;

location / {
proxy_pass http://127.0.0.1:10029;

   proxy_http_version 1.1;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "upgrade";
   proxy_read_timeout 600s;

   proxy_redirect    off;
   proxy_set_header  Host             $http_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;
 }

}

Do you know what could be wrong with my config. ?

Any help would be appreciated

Thank you


#2

I managed to solve my problem. The nginx configuration file above is working for me

By the way Here is is a nice tutorial playlist for starters to Nginx : youtube link

For the other issues encountered [1. Apps not loading correctly behind NGINX proxies #2372], i found the solution in this topic : Problem with nginx in combination with development shiny version