Created
January 1, 2019 10:12
-
-
Save franzwong/77e9738fc012efb370bddde6ec415f0c to your computer and use it in GitHub Desktop.
Dockerized nginx as reverse proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events {} | |
http { | |
upstream webapp { | |
server host.docker.internal:3000; # development only | |
} | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
proxy_pass http://webapp; | |
proxy_set_header X-Forwarded-For $remote_addr; # reset X-Forwarded-For | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# map port 8080 (host) to 80 (docker) | |
docker run \ | |
--name my-nginx \ | |
-v $PWD/nginx.conf:/etc/nginx/nginx.conf:ro \ | |
-d \ | |
--rm \ | |
-p 8080:80 \ | |
nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment