Connection refused : Nginx HTTPS reverse proxy in docker container

ganeshkaila

I wanted to setup https reverse proxy with nginx on docker container either ubuntu/centos. On Browser side, I am getting connection refused error. And also, I cannot see anything under /var/log/nginx/access.log or /var/log/nginx/error.log.

I am able to setup http reverse proxy with nginx on docker container again. And, also https reverse proxy with nginx on normal ubuntu and centos virtual machines.

Can understand the reason why https reverse proxy with nginx on docker containers is failing to connect from browser.?

If any additional information needed, I can provide you. Thanks in advance.

For reference, Please check this sites-available/default file.

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

    server {
      listen 443 ssl;
      server_name localhost;

      ssl_certificate /etc/nginx/ssl/cert.pem;
      ssl_certificate_key /etc/nginx/ssl/cert.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;

      location ~* /rabbitmq/(.*) {
        rewrite ^\/rabbitmq\/(.*)$ /$1 break;
        proxy_pass http://127.0.0.1:15672;
        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-NginX-Proxy true;
        proxy_redirect http:// https://;
      }

      location ~* /api/(.*) {
        rewrite ^/api/(.*)$ /$1 break;
        proxy_pass http://127.0.0.1:3000;
        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-NginX-Proxy true;
        proxy_redirect http:// https://;
      }
    }

Thanks, Ganesh

ganeshkaila

Looks, I need to expose both HTTP and HTTPS ports, since nginx reverse proxy configured to server only HTTPS traffic.

docker run -d -p 80:80 -p 443:443 nginx-container

When I started exposing HTTPS port, then it worked.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Connection refused on nginx docker container

From Dev

What is causing this 111 Connection Refused error in an Nginx reverse proxy setup?

From Dev

Connection refused on docker container

From Dev

NGINX Reverse proxy with HTTPS

From Dev

Docker nginx proxy_pass - Upstream connection refused

From Dev

docker nginx container not receiving request from outside, connection refused

From Dev

Setting nginx reverse proxy to serve from another docker container

From Dev

Nginx reverse proxy to map /blog to wordpress docker container

From Dev

Running NGINX as a Reverse Proxy on Docker?

From Dev

NGINX reverse proxy to docker applications

From Dev

Using Nginx reverse proxy with Docker

From Dev

Nginx connection refused while connecting to Node.js upstream inside a Docker container

From Dev

docker nginx connection refused while connecting to upstream

From Dev

Nginx https reverse proxy infinite loop

From Dev

Nginx https reverse proxy another 502

From Dev

Minimal configuration for Apache reverse proxy in Docker container

From Dev

NGINX Reverse Proxy failing with Linked Docker Containers

From Dev

Connection Refused connecting from docker to Elasticsearch docker container

From Dev

nginx proxy_pass to a linked docker container

From Dev

Spring boot inside docker container throws java.net.ConnectException: Connection refused (Connection refused)

From Dev

Connection refused when try to connect http server in docker daemon container

From Dev

Outbound telnet connection from Docker container refused but works fine on host

From Dev

Docker mongo image 'Connection refused' from other container

From Dev

HHVM + NGinx Connection refused

From Dev

Nginx and uwsgi connection refused when placed in separate docker containers

From Dev

how to handle nginx reverse proxy https to http scheme redirect

From Dev

NginX as HTTPS reverse proxy for multiple sub-domains?

From Dev

NGINX as reverse proxy on another container - how to configure the config files

From Dev

Original url when using nginx container as reverse proxy

Related Related

  1. 1

    Connection refused on nginx docker container

  2. 2

    What is causing this 111 Connection Refused error in an Nginx reverse proxy setup?

  3. 3

    Connection refused on docker container

  4. 4

    NGINX Reverse proxy with HTTPS

  5. 5

    Docker nginx proxy_pass - Upstream connection refused

  6. 6

    docker nginx container not receiving request from outside, connection refused

  7. 7

    Setting nginx reverse proxy to serve from another docker container

  8. 8

    Nginx reverse proxy to map /blog to wordpress docker container

  9. 9

    Running NGINX as a Reverse Proxy on Docker?

  10. 10

    NGINX reverse proxy to docker applications

  11. 11

    Using Nginx reverse proxy with Docker

  12. 12

    Nginx connection refused while connecting to Node.js upstream inside a Docker container

  13. 13

    docker nginx connection refused while connecting to upstream

  14. 14

    Nginx https reverse proxy infinite loop

  15. 15

    Nginx https reverse proxy another 502

  16. 16

    Minimal configuration for Apache reverse proxy in Docker container

  17. 17

    NGINX Reverse Proxy failing with Linked Docker Containers

  18. 18

    Connection Refused connecting from docker to Elasticsearch docker container

  19. 19

    nginx proxy_pass to a linked docker container

  20. 20

    Spring boot inside docker container throws java.net.ConnectException: Connection refused (Connection refused)

  21. 21

    Connection refused when try to connect http server in docker daemon container

  22. 22

    Outbound telnet connection from Docker container refused but works fine on host

  23. 23

    Docker mongo image 'Connection refused' from other container

  24. 24

    HHVM + NGinx Connection refused

  25. 25

    Nginx and uwsgi connection refused when placed in separate docker containers

  26. 26

    how to handle nginx reverse proxy https to http scheme redirect

  27. 27

    NginX as HTTPS reverse proxy for multiple sub-domains?

  28. 28

    NGINX as reverse proxy on another container - how to configure the config files

  29. 29

    Original url when using nginx container as reverse proxy

HotTag

Archive