Quantcast
Channel: Active questions tagged macos - DevOps Stack Exchange
Viewing all articles
Browse latest Browse all 31

502 bad gateway with Nginx, Colima, Docker on macos for port forwarding of 443 and 80

$
0
0

I need to redirect port 443 and 80 to port 3000 of localhost using nginx on docker-compose, docker and colima on macos but it throws 502 bad gateway.This is happening on macos and on linux machine the configuration works fine.here is my DockerFile:

FROM nginxCOPY ["nginx/nginx.conf", "nginx/req.cnf", "/etc/nginx/"]RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt -config /etc/nginx/req.cnf

This is my docker-compose.yml file:

version: "3.7"services:  nginx:    container_name: nginx    restart: always    network_mode: host    build:      dockerfile: ./Dockerfile-dev

and this is my nginx.conf:

events {}http {    server_tokens off;    charset utf-8;        upstream frontend {            server 127.0.0.1:3000;          }    server {        listen 80;        listen 443 ssl http2 default_server;        listen [::]:443 ssl http2 default_server;        ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;        ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;        location / {            proxy_pass http://frontend/;            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;            try_files $uri $uri/ /index.html @forward;            error_page 405 @forward;        }        location @forward {            proxy_pass http://frontend;            proxy_set_header X-Forwarded-Proto $scheme;            proxy_set_header X-Real-IP $remote_addr;        }    }}

is there anything else that i need to add for macos specifically?

Thanks in advance.


Viewing all articles
Browse latest Browse all 31

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>