Since I have to try new rewrite rules or build POC implementations from time to time, I started using docker for rapid prototyping. Here is an easy 4 step tutorial how to do that.
Step 1 extract a default config from the nginx container.
docker run --rm -v $(pwd):/tmp/demo nginx cp /etc/nginx/conf.d/default.conf /tmp/demo/Step 2 edit the default.conf
Step 3 run the container with the edited default.conf
docker rm -f nginx-demo || true; \ <br/>
docker run --name nginx-demo -p7000:80 -v $(pwd):/etc/nginx/conf.d:ro -d nginx; \ <br/>
docker logs nginx-demo
first line removes a maybe existing container from a last run
second line starts the container with your local config
third line prints the logs to see possible configuration errors
Step 4 try your rewrite rules against http://localhost:7000
And that's it.