Question

How to access port 8000 on https

I’m running a docker container as shown docker run --rm -it -p “8000:8000” -v “/home/scott/stellar:/opt/stellar” --name stellar stellar/quickstart --testnet

i can access it on my VM using http://tokensaletest.southcentralus.cloudapp.azure.com:8000/

but i want to access it via https like https://tokensaletest.southcentralus.cloudapp.azure.com:8000/

please how do i do that. here’s my Nginx config


upstream gogs {
  server tokensaletest.southcentralus.cloudapp.azure.com:8000;
}
server {
         # SSL configuration
        #
         listen 443 ssl default_server;
         listen [::]:443 ssl default_server;
       
        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name tokensaletest.southcentralus.cloudapp.azure.com;

        #Change ssl_certificate and ssl_certificate_key to point towards your SSL Certificate and your SSL key, respectively.
        ssl_certificate /etc/nginx/ssl/sureremittokensecurewebcert.pem;
        ssl_certificate_key /etc/nginx/ssl/sureremittokensecurewebkey.key;

        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_prefer_server_ciphers on;


        location \ {
            proxy_pass         https://gogs;
            proxy_redirect     off;
            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-Host $server_name;
        }

         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php7.0-cgi alone:
                fastcgi_pass 127.0.0.1:9000;
                # With php7.0-fpm:
                #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }
}

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

after updating my default nginx configuration file to this, it worked

server {
    listen 80;
    return 301 https://$host$request_uri;
}

server {

    listen 443;
    server_name tokensaletest.southcentralus.cloudapp.azure.com;

    ssl_certificate           /etc/nginx/ssl/cert.pem;
    ssl_certificate_key       /etc/nginx/ssl/key.key;

    ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;

    access_log            /var/log/nginx/jenkins.access.log;

    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;

      # Fix the “It appears that your reverse proxy set up is broken" error.
      proxy_pass          http://localhost:8000;
      proxy_read_timeout  90;

      proxy_redirect      http://localhost:8000 https://tokensaletest.southcentralus.cloudapp.azure.com;
    }
  }