nginx

Create config file.

mkdir nginx
vi nginx/default.conf
server {
    listen 80;
    server_name localhost;

    location / {
        proxy_pass http://host.docker.internal:8080;
        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; # original request scheme: helps to distinguish http and https
    }
}

Create Dockerfile for copying config file.

vi Dockerfile
FROM nginx:latest
COPY ./nginx/default.conf /etc/nginx/conf.d/

Build and run nginx.

Last updated