$ git clone https://github.com/cbelda/nginx4reverse-proxy.git
That means, edit nginx.conf
to redirect one local URL (local for the container) to a different one. It could also be a different local one.
For example:
- nginx container running in
http://localhost:80
- Container's URL (local) :
http://localhost:80/api
- Proxied URL :
http://www.github.com
nginx.conf:
server {
...
location /api {
proxy_pass http://www.github.com;
}
...
}
$ cd nginx4reverse-proxy
$ docker build -t nginx4reverse-proxy .
$ docker run -it -d -p 80:80 --name=nginx4reverse-proxy nginx4reverse-proxy