Path-based routing lets a reverse proxy direct URL paths to different backend containers. An image-gallery site can serve its web UI and REST API from separate containers while clients use one domain. section 20.2
A practical Nginx workflow is:
- Add the site domain to the local hosts file and start the application containers. section 20.2
- Install the Nginx site configuration that adds an API path, then reload Nginx. section 20.2
- Request the API through the shared domain, such as /api/image, and verify that the API container responds. section 20.2
# remove the original image-gallery configuration: rm ./nginx/sites-enabled/image-gallery.local # copy in the new one, which adds the API, and reload nginx: cp ./nginx/sites-available/image-gallery-2.local ` ./nginx/sites-enabled/image-gallery.local docker exec nginx-nginx-1 nginx -s reload curl -i http:/./image-gallery.local/api/image
Use the configuration replacement, Nginx reload, and curl command to test path-based API routing. section 20.2

