Changing port for ssl connection in nginx

27 views Asked by At

I want to publish some shiny app from my pc at home. I have configured correctly the ssl certificates and the web is reachable here:

https://shiny-server.modlearth.com:8443/shiny/

The web is accesible, but not without indicating the correct port: 8443, which I have configured also nicely in the nginx file. Here is my nginx config file:

server {
        listen [::]:8443 ssl ipv6only=on; # managed by Certbot
        listen 8443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/shiny-server.modlearth.com-0002/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/shiny-server.modlearth.com-0002/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;

        server_name shiny-server.modlearth.com www.shiny-server.modlearth.com;

        #location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #try_files $uri $uri/ =404;
        #        return 301 https://www.modlearth.com$request_uri;
        #}
        location /shiny/ {
                proxy_pass http://0.0.0.0:3838/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                #proxy_set_header Connection $connection_upgrade;
                rewrite ^(/shiny/[^/]+)$ $1/ permanent;
        }
        location /rstudio/ {
                proxy_pass http://0.0.0.0:7878/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                #proxy_set_header Connection $connection_upgrade;
        } 
}

server {
        if ($host = shiny-server.modlearth.com)  
                return 301 www.modlearth.com;
        } # managed by Certbot

        listen 81;
        listen [::]:81;

        server_name shiny-server.modlearth.com;
        return 404; # managed by Certbot
}

However, if I use the web without the port, the connection seems to be doing to 443.

curl -k https://shiny-server.modlearth.com/shiny/
curl: (7) Failed to connect to shiny-server.modlearth.com port 443 after 30 ms: Connection refused

The port 443 and 8443 are open in the router. But, my internet provider says that 443 "is for them" and I can't use it.

How do I get my shiny app through this ?

0

There are 0 answers